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.
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).
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).
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.
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
<html> <body> <h1>Hello Linux Magazine Readers!</h1> <p>Here is a demo of how everybody may embed <strong>dynamic</strong> CKAN data visualizations into any Web page:</p> <iframe width="700" height="400" src="http://dati1.comune.mt.it/dataset/lavori-in-corso/resource/1fdd9b53-ffad-40ad-972e-e8f5b2714874/view/998f252b-c043-41fb-8885-b076fe455dce" frameBorder="0"></iframe> <p>All I had to do to get the same functionality of the original portal, with <strong>clickable</strong> tabs for graphs, maps, filters and so on, was to copy and paste here the text I got from the "Incorpora" function!</p> </body> </html>
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?
Infos
- CKAN: https://ckan.org/
- Open Knowledge Foundation: https://okfn.org/
- Apache Solr: https://solr.apache.org/
- REST APIs: https://restfulapi.net/
- DCAT-AP: https://joinup.ec.europa.eu/collection/semantic-interoperability-community-semic/solution/dcat-application-profile-data-portals-europe/release/11
- Italian national open data portal: https://dati.gov.it [In Italian]
- European open data portal: https://data.europa.eu/en
- Maurizio Napolitano: https://twitter.com/napo
- Vincenzo Patruno: https://twitter.com/vincpatruno
- onData APS: https://www.ondata.it/ [In Italian]
- OPENdata Trentino: https://dati.trentino.it/ [In Italian]
- Matero open data: http://dati1.comune.mt.it [In Italian]
« Previous 1 2
Buy this article as PDF
(incl. VAT)