Solution: selecting the less polluted routing

In the example developed in this page, MicroServices retrieve information from the Smart City storage and info to create a dashboard that tells the user which is the less polluted path at a precise moment to go jogging. If predictive data are available, it can work on predictions.

 In Figure 9, the dashboard presents two possible paths on which to go jogging and in the centre there are the values of O3, PM 2.5 and PM 10 of the two respective paths.

 

Figure 9: Personal Dashboard for deciding the less polluted path for jogging.

The flow that realizes the logic behind the dashboard is shown in Figure 10. This dashboard has been created automatically when the Node-Red flow has been deployed the first time. In the flow, the blue nodes, correspond: the outermost ones on the right to the two maps with the routes, the six central on the right to the Gauge Charts that report the values of the pollutants and the only one on the left to the "Update" button that allows to recalculate the data when is pressed. These nodes automatically create the widgets on the dashboard and if the latter does not exist they also create the dashboard, without any required intervention by the user who only has to enter the name of the dashboard and those of the Widgets when configuring the nodes.

 

 

Figure 10: IOT Application with the logic of Dashboard of Figure 9.

The orange nodes on the left called "PARCO DELLE CASCINE" and "PARCO VIA FONTALLERTA" allow the user to calculate the shortest path between two geopoints. With a simple visual configuration, as shown in Figure 11, you can choose a starting point, an arrival point, the time at which you want to make the trip and the means of transport: the node in an exit will produce a JSON containing all the information about the calculated route. As you can see, the complexity of the route calculation is hidden from the user who has the result of his request in a simple and intuitive way.

 

Figure 11: Setting for routing of IOT App of Figure 10, and of Dashboard of Figure 9.

 In this Node-Red flow, unlike the previous example, a minimum of programming ability is required: the JSON that is returned from the previous nodes also contains the complete path calculated by the system and this must be divided into its main points with the function nodes made available by Node-Red where the user can interact with the variables by writing code in JavaScript. 

The other six orange nodes on the left, internal to those just described and which have the names of the pollutants, allow you to have punctually the value of that substance in a given geographical point.

Also in this case the complexity that is behind this value is hidden to the user who manages to have in a few steps that value in his hands and can use it as he pleases. The complexity that the user does not see requires the recovery of all the sensor data available in the area you are considering, the calculation of a heatmap also relating to the points where the sensors are not located, its storage on a geoserver and the recovery of timely data from that geoserver with the creation of APIs dedicated to this particular service. The calculation of the heatmap must be done periodically and in turn this periodicity has been done with a special flow Node-Red that executes with the pre-determined frequency the script R that calculates the heatmap. Please note that, the sensors are typically located in some are specific point may be very distant from the computed routing. A service in the smart city back office compute the heatmap and provide a MicroServices which allow to get the value of pollutant as well as of temperature, humidity, etc. in any point of the area.

In the flow of Figure 10, the values of the polluting elements are calculated for the main points of the routes returned by the first two nodes and the average is made to have an indicator of pollution for that route. The user who has created a dashboard made in this way can press the update button before going for jogging and know where to go running to breathe cleaner air. The automated update can be programmed as well.