Managing open data with CKAN

Public Works in Matera

The second example of CKAN's power, courtesy of Patruno, comes from the ancient city of Matera, filming location for The Passion of the Christ and the 2019 European Capital of Culture. Because a place with so much history requires more maintenance than most, Patruno and others prepared a CKAN demo [12] that, among other things, contains the database of all the public works in progress (Lavori in corso), shown in Figure 6.

Figure 6: A detailed list of public works in Matera.

Despite the difference in location and data, Matera's interface looks the same as Trento's interface (Figure 2), which is exactly the point of CKAN. Localization may be different (e.g., Data Explorer in the Trento version versus the Italian translation Esploratore Dati in Matera's interface), but a CKAN user in either city would have no problems using either portal.

Each entry in Figure 6 provides the project name, budget, managers, contract holder, and percentage of work completed for public works planned, ongoing, or completed in Matera.

Like the geographical coordinates used in Figure 5, CKAN lets you plot other numbers. The Grafo tab in Figure 6 (or the Graph tab in Figure 2) lets you quickly create all sorts of charts to visualize the raw data, just as you would in spreadsheet software. In Figure 7, for example, I plotted each project's work progress (when available).

Figure 7: Besides mapping, CKAN supports data visualization, much like ordinary spreadsheets.

You can also create a downloadable versions of the dataset in JSON format (Figure 8). For each dataset, CKAN also automatically creates a web page (Figure 9) listing all the access links (endpoints) to that dataset, as well database query samples in several programming languages. To generate the Data API web page, click on the Data API button (not shown in the figures).

Figure 8: Clicking on the Download button, you can get the entire dataset, either raw or in JSON format, or just its headers.
Figure 9: CKAN's Data API web pages list all the ways in which third-party software can access each dataset.

The Best for Last

I saved the coolest part of what Napolitano and Patruno shared for last. The Incorpora (embed) button in Figures 2 and 6 lets another website offer all the services I just explained! Clicking on that button opens the panel in Figure 10, where you can define the size of an HTML iframe for the dataset and then copy the corresponding HTML code.

Figure 10: You can copy and paste the embed code shown here into any program that supports HTML.

I wrote Listing 1 in less than three minutes, by pasting the code in Figure 10 into an empty file and wrapping it with the bare minimum of HTML markup, a title, and two short explanation paragraphs.

Listing 1

Sample HTML Code

 

That's all I had to write to create the visually bare, but perfectly working dynamic web page shown in Figure 11. The web page in Figure 11 will let you sort or search the dataset, map its content, or make charts with it, just like on the original website. Openness is really cool, isn't it?

Figure 11: CKAN services are easy to embed in other websites. Just grab the code from the original server and paste it wherever you need it.

Infos

  1. CKAN: https://ckan.org/
  2. Open Knowledge Foundation: https://okfn.org/
  3. Apache Solr: https://solr.apache.org/
  4. REST APIs: https://restfulapi.net/
  5. DCAT-AP: https://joinup.ec.europa.eu/collection/semantic-interoperability-community-semic/solution/dcat-application-profile-data-portals-europe/release/11
  6. Italian national open data portal: https://dati.gov.it [In Italian]
  7. European open data portal: https://data.europa.eu/en
  8. Maurizio Napolitano: https://twitter.com/napo
  9. Vincenzo Patruno: https://twitter.com/vincpatruno
  10. onData APS: https://www.ondata.it/ [In Italian]
  11. OPENdata Trentino: https://dati.trentino.it/ [In Italian]
  12. Matero open data: http://dati1.comune.mt.it [In Italian]

The Author

Marco Fioretti (http://mfioretti.substack.com) is a freelance author, trainer, and researcher based in Rome, Italy, who has been working with free/open source software since 1995 and on open digital standards since 2005. Marco also is a board member of the Free Knowledge Institute (http://freeknowledge.eu).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Smart Cities

    Making the city of Messina, Italy, smarter with open source and IoT.

  • Open Data

    The open data movement extends the ideals of open source to government data and, ultimately, all the world's knowledge.

  • Light Browsing

    This Chromium port can run inside any console, with minimal resources, and is a great tool for making old computers really useful – and learning programming along the way.

  • WebhostingDay: Open-Xchange to Initiate Open Data Cloud

    Rafael Laguna de la Vera, CEO of Open-Xchange AG, gave Linux Magazine Online a preview of his upcoming Open Data Cloud at the WebhostingDay 2009 (WHD09) in Cologne, Germany

  • Verona's University Migrates 4000 PCs to Linux

    Verona is about to become famous for more than just Romeo and Juliet and opera: the university of the romantic Italian city is migrating 4000 of its desktops to Linux and open source.

comments powered by Disqus