Support Us

You are browsing the archive for 2013 March.

Adding custom previews to CKAN

Dominik Moritz - March 13, 2013 in Extensions, Feature

A new feature in CKAN 2.0 enables you to add custom previews for different file types.

CKAN’s ability to preview resources gives users a quick way to check if they have the dataset they need – as well as to begin to explore the data. CKAN has built-in previews for certain filetypes, such as images and CSV files. However, if you have resources in another format, users cannot preview them. Custom previews provide a simple way to add previews for more filetypes, or even modify existing preview methods.

[IMG: preview]

Map preview of CSV file in CKAN

New previews can be build as a CKAN extension with the help of the IResourcePreview interface. This is the same interface as CKAN already uses for built-in previews. (Note that, while most of these are enabled by default, the built-in PDF preview is not. To enable PDF preview, you need to edit the CKAN .ini file and add pdf_preview to ckan.plugins.)

A preview extension must implement three methods:

  • can_preview to indicate that it can preview the dataset,
  • preview_template to return the template for the preview, and
  • setup_template_variables to add the data that should be rendered to the template.

If you happen to write an extension that previews files that are fetched via an Ajax call, you should also have a look at the resource proxy extension. This offers a workaround for the same origin policy which normally prevents files being fetched from a domain that is different from the domain of the CKAN site.

To get started with your own preview extension, I recommend that you read the extension documentation linked above, and then have a look at the built-in preview extensions at ckanext. If you have any questions, let us know on the mailing list and we’ll try to help.

Translators needed!

Sean Hammond - March 11, 2013 in Releases

We’re preparing to release CKAN 2.0 in a few weeks time, and we need help with translations.

CKAN’s user interface is available in over 20 languages. The new version introduces over 450 new words and strings in the interface, and they all need translating before it’s released. If you speak one of the relevant languages, you can join that language team to help with the translation effort.

If you are a speaker of a language where CKAN isn’t available yet, this would also be a great time to start a translation project for it!

If you can help with translating the strings and keeping CKAN open to people across the world, please sign up here to contribute.

Building the Aragón Open Data website with CKAN

Jose Maria Subero - March 6, 2013 in Deployments

We are very proud that the Spanish region of Aragón finally has its own open data website: Aragón Open Data was launched in February, using CKAN. At the Government of Aragón ICT department, we are really concerned with the value of data and information. This CKAN-powered website is our first step to providing citizens with easier access to data. For the launch, we published more than 230 datasets rated with 2, 3 and 4 Tim Berners-Lee stars.

Why choose CKAN?

When we made the decision to publish the region’s open data in a single place, we wanted a ‘CMS for data’, and we took a look at the different options. CKAN was the best solution for our needs for several reasons, but a few stand out.

Firstly, the API. For the Aragón Open Data team, it is important to make it easy for developers to access data. This problem is solved with CKAN´s API. The API lets you get a reliable ID of a dataset, and use it to query for the current version of the dataset. This allows developers to have a unique object to download and also know when the dataset has changed. For developing apps based on the data, this is a perfect way to ensure you always have the latest data.



Secondly, the CKAN back-end. It has been developed as a kind of CMS specialised for data, and the data management tools that CKAN provides are really useful to get your metadata ‘tidy’. It is easy to modify the different attributes of a dataset and to add new extra fields to improve the description of your datasets.

To give structured formats to advanced users that want to develop applications, we wanted a metadata file for each dataset: a file expressing all the metadata in RDF format using the DCAT vocabulary. CKAN helped as it has built-in RDF output, though there is no link to this by default. To make it more prominent, we were easily able to write a CKAN extension which put a link on each dataset page to the RDF metadata.

Finally, having made the decision to use CKAN, it was easy and intuitive to install using the published documentation and to develop the website using it. We are now working on extending the website using more of the posibilities that CKAN provides.

Open data, open spending

To reinforce our commitment to open data, we have also developed an open spending application: Through this app it is possible to ‘follow the money’ from citizens’ taxes through to public expenditure. You can also see in what policy area money has been spent during the last 8 years. You can calculate, depending on your earnings, how much of your money goes to each policy area. Finally there is a brief glossary of spending terms to help users better understand the budget’s vocabulary.

We hope you find useful data in the Government of Aragón’s data catalogue, and we will be very happy if you develop any data-based applications with it. Enjoy Aragón Open Data!