Snap4City supports the connection with CKAN Open/Private Data Portals. The CKAN integration is a scenario in which Snap4city solution is used to realize automated solutions to:
- automating the Import data from CKAN to Snap4City
- automating the Upload Public Data from Snap4City to CKAN
- Data Harvesting
- automating the Creation of Snap4City Dashboards and Mobile/Web Apps in which can be viewed with advanced tools: real time data, historical data, heatmaps, etc. and on which are available decision support services, as the what-if analysis, and remote control services.
Test Case Title |
TC9.17 – CKAN vs Snap4City Integration and Interaction |
Goals |
Interact with CKAN tool to:
|
Prerequisites |
Using a PC or Mobile with a web browser. You need a Snap4City account. If you want to create a Resource or a Datyaset on CKAN (and not only read them) you must have an account on CKAN. The following functionalities are available only for specific Snap4city users with specific privileges. |
Expected successful result | Generation of flows of data to interact with CKAN. |
Snap4City can interact with external CKAN portal in various ways via IOT applications. In the next, some real examples of possible interaction between Snap4City and CKAN are explained.
- Automating Read Dataset Info from CKAN
The following IOTApp flow shows how to read a dataset (called package in CKAN) on the basis of its name or identifier. A package is a container of a set of real data.
The function node, uses the CKAN API by indicating the CKAN package of interest. As shown in the following image, if the resource is private, you have also to include the CKAN user APIkey to access to it. Please note that CKAN API are explained here: https://docs.ckan.org/en/2.8/api/
In the example above, the resource of interest has the id “=from_snap4city_to_ckan”.
The node http request sends HTTP requests and returns the response on the basis of the URL defined in the function node.
The node json simply allows to make more readable the results in the debug area.
- Automating Read Resource info from CKAN
The following flow allows to recover a single resource information from the CKAN tool on the basis of its name or identifier.
In this example, the function node uses the CKAN API to search a resources matching a query by using the resource id. Please note that CKAN API are explained here: https://docs.ckan.org/en/2.8/api/
As in the previous example, the node http request sends HTTP requests and returns the response on the basis of the URL defined in the function node.
The node json simply allows to make more readable the results in the debug area.
- Automating Create a Dataset on CKAN
In this example, the flow allows to create a dataset into the DISIT organization in CKAN. The dataset is created according to the fields reported in the json in the function node.
The function node is shown in the following image. In this case the code specifies also the organization ID and the user API key, in case the resource is not public.
The data_json reports the list of fields useful to create the dataset.
The http request node specifies the CKAN API to be used. Please note that CKAN API are explained here: https://docs.ckan.org/en/2.8/api/
- Automating Create a static resource in CKAN
This following flow creates a static resource containing a link to a resource in Snap4City and public this link directly on CKAN as private resource of the user.