[ckan-dev] ckanext-inventory

Adrià Mercader adria.mercader at okfn.org
Wed Feb 24 10:24:01 UTC 2016


Hi Alex,

Thanks a lot for sharing your experiences here and congratulations on
the great work on the Romanian portal.

Feel free to join one our dev meetings if you want to discuss any
particular issue or just have a chat in general about CKAN and
extensions development!

Details are here: https://pad.okfn.org/p/ckan-meeting

On 22 February 2016 at 20:38, Alex Palcuie <alex.palcuie at gmail.com> wrote:
> One of the use cases that appeared after a law was adopted in my
> country was that every governmental institution has to publish its
> inventory of datasets. This means every organization (and we have over
> 8k) has to identify a list of its possible datasets and publish it on
> data.gov.ro.

What are these inventories exactly? Are they files in some format that
are harvested or imported somehow?

> An advice would be to make the default docs[2] page for CKAN to be the
> last production version (as it is on Django[3]) and not the latest
> branch. This I remember was a little confusing at first.

That is probably the best option. Do you want to create an issue on
the main CKAN repo so we can address this?

> After I made a list of the best CKAN extensions[4], I found out that a
> pattern is to copy paste the original code and slightly modify it[5].
> It didn't feel good to me, and I realized afterward that hooks (or
> signals in Django's terms) for the user controller were missing. When
> I'll start refactoring that part, I'll commit upstream the
> modifications needed. The Javascript part of making the API request
> was well documented and it worked seamlessly.

That sounds great, let us know if you need guidance on how to
implement changes to allow extending the user behaviour


> The next flow I implemented was that before users can add a new
> dataset, they must add an inventory entry for it and a recurring
> interval[9][10]. For example, an organization could have the inventory
> entry Budget with a recurring interval of 365 days. Now, their
> datasets will be Budget 2015, Budget 2016 and so on, and specifying
> that recurring interval means that we can monitor them to see if they
> have updated the dataset in the time they have assumed and ping them
> with automatic emails if they haven't.

This sounds really useful for a lot of government portals.


> One thing that I did not manage was to use the IGroupForm and
> IDatasetForm interfaces in one single extension. I had to make a
> hack[7] with 2 classes, because some methods, like `is_fallback`,
> overlapped and the plugin setup would now know which method to use.

I guess you mean a single plugin (ie a single Class). That is expected
as both interfaces share some method names. It's probably best to
split these in separate plugins anyway to separate concerns, and you
can definitely have multiple plugins in the same extension.


> However, I think it's mostly my fault because I've developed the
> extension as a big monolith, without thinking too much on planning. My
> plan is after I release this into production this month, to split up
> the small features I can into smaller extensions, write tests for them
> and release them on PIP, with a follow-up email on this list.

Looking forward to it!

> All in all, I had lots of fun developing this extension that I think
> will become useful for us. I want to thank you all for making CKAN a
> nice platform to work on and making a great community.

Thanks for being part of it


Adrià


> Alex
>
> [0]: http://data.gov.ro
> [1]: https://github.com/govro
> [2]: http://docs.ckan.org
> [3]: https://docs.djangoproject.com/en/1.9/
> [4]: https://github.com/govro/ckanext-inventory/blob/master/docs/best_extensions.md
> [5]: https://github.com/govro/ckanext-inventory/blob/master/ckanext/inventory/controllers/user.py
> [6]: https://github.com/ckan/ckan/search?q=table&type=Issues&utf8=✓
> [7]: https://github.com/govro/ckanext-inventory/blob/master/ckanext/inventory/plugin.py
> [8]: https://i.imgur.com/j2GKMbq.png
> [9]: https://i.imgur.com/sSce4Nm.png
> [10]: https://i.imgur.com/34NAd9B.png
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev



More information about the ckan-dev mailing list