TC9.13: How to upload a local file into the platform (IOT Application and MyKPI)

×

Warning message

You can't delete this newsletter because it has not been sent to all its subscribers.

Test Case Title

TC9.13: How to upload a local file into  the platform (IOT Application and MyKPI)

Goal

I can load a local file from my own computer to the platform and use it as data.

I can load a local file with data to my IOT application on cloud to use the data included. It can be a file of parameters as wll as a file with personal data that can processed or elaborated to be saved into the MyKPI repository. The first step  shown in this TC can be used to shown data file on dashboard, published on DataGate, sent to a IOT device, etc.

Prerequisites

Using a PC with a web browser. You need credentials to access at the platform and thus to the IOT application.

Expected successful result

usage of your personal data into the Snap4City platform according to your needs. 

Steps

 

 

This page is focussed on guiding the users in adding data into the platform which are in a file (for example .csv). This data would be imported on the platform.

    1. Click on the IOT Applications on the left bar and press the “Create new” button

 

    1. It’s possible to specify the name of the IOT Application you want to create.  Please press confirm to create the IOT Application.

 

    1.  After the IOT Application has been created, it is shown in the list of the IOT Application.

    1. Enter in the IOT Application with double click on it and start to edit. Please remember to Deploy the IOT Application to save the current flow.

    1. It is possible to load a stream already created through the "Import" button shown in the image and then on the "Import S4C" element.
    2. In this guide we have to insert the flow "To upload a file from your local computer into the NodeRed".
    3. NEW VERSION 2020 of the FLOW: https://www.snap4city.org/drupal/sites/default/files/files/CSV-Upload.txt

    1. To import the flow, you have to click on the name of the flow and once the name of the flow is underlined click on the red button import
    2. NEW VERSION of the FLOW: https://www.snap4city.org/drupal/sites/default/files/files/CSV-Upload.txt

    1. The flow will appear on the mouse and you can move it where you want and then click “Deploy”.
    2. To upload a file at this point you must link to the site https://iot-app.snap4city.org/ (this link would not work for you) adding at the end what is indicated in the nodes. Please note that nrh6q53 is the name of the IOT App that I have used for creating this example. Please use yours.

    1. If we use the first one we will connect to https://iot-app.snap4city.org/nodered/nrh6q53/simple (this link is only for demo, it is not connected to your IOT App) and you can upload the file with this interface:

    1. If we use the first one we will connect to https://iot-app.snap4city.org/nodered/nrh6q53/complex   (this link is only for demo, it is not connected to your IOT App) and you can upload the file with this interface:

    1. Assuming you use the simple interface, let's see how to load a file and insert it into the KPIs.
    1. First you need to create a MyKPI. To this end, you need to access at the KPI Editor from the main menu item "My Data, KPI, POI".

               

    1. And you can access the "KPI Editor"

    • In this editor you can see your own Kpi Data by selecting My at the top, the Public Kpi Data by selecting Public at the top and the Kpi Data delegated by another user to the logged in user by selecting Delegated. To add your own KPI you can press the button at the top with Add My KPI and fill in at least the required fields in the form that is shown.        

    1. Choose Nature and SubNature according to the value you want to record, name that value in the ValueName field, indicate a unit of measure for that value in the ValueType field and select a format in DataType. In addition to these mandatory values, you can add additional information that the user wants to add to this data. An example:

    1. Once you have filled in the desired fields you can press the Save button at the bottom of the form and we will get a new line in the KPI Editor:

    1. Having created a KPI it is possible to use the nodes present in the following menu:

    1. And in particular the node:

    1. Clicking twice on this node you can see the configuration and in the initial list you should choose the KPI on which to send the data that must show the one just created in the KPI Editor.

    1. Remember to click the red button “DONE” to save the configuration.
    1. If the file we are going to upload is a CSV, we can use the CSV node to remap the CSV in a JSON. The data that can be loaded within a KPI are value, date of value, latitude and longitude and the names of the columns of the CSV file must respect this (the same) nomenclature:

    1. Then we insert a CSV node and cascade the node to save the KPIs: In the CSV node configuration we checked the checkbox indicating that the first line indicates the names of the variables

    1. We get this flow after the additions made
    1. You can add a debug node to follow the KPI node to check that the entry is successful.

    1. Once the flow is finished, go to the simple interface and click on "Choose File:", choose it and then click on submit. This is what should be shown on the web page: it represents the content of the file you are uploading.
    1. If everything worked in the "DEBUG" tab, you must have a message similar to the following one that repeats the input data with the id that was given to it.

    1. It is also possible to see the data entered in the KPI Editor by pressing the "VALUES" button of the KPIs used.

    1. And view the values:

Then you can also use these data into any dashboard. Please remind that their nature is “MyKPI