[ckan-dev] Apps Catalogue

Rufus Pollock rufus.pollock at okfn.org
Sat Jun 11 12:27:16 UTC 2011


On 10 June 2011 23:39, Friedrich Lindenberg
<friedrich.lindenberg at okfn.org> wrote:
> Hi James,
>
> thanks for your input on this. As you suggested I started off from
> Wayne's repository but ended up basically doing a rewrite of most of
> the extension. I now have a working extension with ideas and
> applications at https://bitbucket.org/okfn/ckanext-apps (I also took
> the liberty of renaming it) and intend to add screenshot support for
> applications and rating for both indexes on sunday.

Great work Friedrich. By the way for ratings I assume you know we
already have a rating system (used to be prominent in WUI but we
disabled it because we thought it wasn't that useful):

<https://bitbucket.org/okfn/ckan/src/tip/ckan/model/rating.py>

Since this is not being used we can refactor it without too much
concern (though I guess we would need a migration -- or at least
remember to drop the rating table if we change it).

Either we can generalize so:

rating_table = Table('rating', metadata,
    Column('id', UnicodeText, primary_key=True, default=make_uuid),
    Column('user_id', UnicodeText, ForeignKey('user.id')),
    Column('user_ip_address', UnicodeText), # alternative to user_id
if not logged in
    Column('object_type', UnicodeText) # package, app, idea ...
    Column('object_id', UnicodeText),
    Column('rating_type', UnicodeText), # e.g. 'default', 'quality',
'up-to-date-ness', ...
    Column('rating', Float),
    Column('created', DateTime, default=datetime.now),
    )

Main changes are: rating_type so we can multiple types of ratings per
object and object_type / object_id so we can ref arbitrary objects.
Approach for latter is rather hacky with proper way to do switching on
ref object type would of course be object inheritance
http://www.sqlalchemy.org/docs/orm/inheritance.html.

Alternative is just to duplicate this for each type you want: ideas, apps etc.

Rufus




More information about the ckan-dev mailing list