CKAN at OKFest

I attended a CKAN workshop OKFest to get to grips with CKAN. It was an interactive session where people can suggest items to run through. The reason I attended this was to get a clearer understanding of how to write extensions for CKAN, especially as I will be writing the SWORD extension in Orbital. I’ve taken a lot of notes during this workshop, which are attached to this post for reference.

A lot was learnt from the afternoon, such as which files should be edited to change difference parts of CKAN. For example, the aptly named plugin.py is where the plugin for CKAN is written. An example of which can be found here – https://github.com/okfn/ckanext-iati/blob/master/ckanext/iati/plugin.py. Templates can be changes easily by changing one variable in plugins.py; def configure_template_directory. This tells CKAN to run these templates, overriding the default ones. Another variable, {% block secondary_content %}, overriders secondary block content, changing the location, colour, size etc of content in the secondary block. Other variables to do with the styling of pages can be chagned to alter the appearance of CKAN and theme it. There is also the web interface, found at /ckan-admin/config. This is just an interface to edit CKAN. So there are a number of different ways to theme CKAN, and I have learnt a lot about where these variables are, what to change them to and the general gist of how to theme and customise.

Extensions are a more important part of CKAN that I went to learn about. Some examples of which are found here: https://github.com/okfn. The plugin.py file also contains variable to do with extensions, such as roots. This is used in conjunction with interfaces.py to set the interfaces that will be used in the extension. These interfaces are used to literally interface with an extension. Packages can be added and modified depending on what the extensions is designed to do. IPackageController modifies the packages, and ‘package_show’package_show_iati – implements a package. These are variables that will be used often with creating an extension. I have only briefly run through these items as there is a lot more depth to them than a blog post should go into.

It was noted that a lot of extensions already exists and are open source, like CKAN. So to write an extension with no experience, it would be a good idea to look at ones already made to see how they are put together. I asked about how to go about making a SWORD extension, as it is likely that a similar extensions already exists. They decided that it was probably best to create it as a web service that CKAN can hook into via APIs. So as long at the web service has APIs that can take one format and spit out another to CKAN it should be fine. Especially as then any other CKAN instance can use it.

The final outcome of this was that the SWORD extension will now be created as a web instance rather than a direct extension of CKAN.

Here are the Notes I took during the workshop.

Leave a Reply

Your email address will not be published. Required fields are marked *