Vibrational energy: big data and small devices

Codemotion
5 min readDec 20, 2019

A functional first-level framework to provide a service to users as an app. Let’s see the case for seismic data from both Italy-based and US-based open data collections.

We are living in a highly vibrating world. The knowledge of many vibrations can help us to live better as individuals, communities and nationwide organisations.

Matter itself is vibrating energy!

This article depicts how to manage vibrational big data, collected and organised for every person willing to know more about how all the places in Italy respond to seismic activity.

Sandro Stancampiano works at Istat, Italy’s National Institute for Statistics. He holds a degree in Literature, and one of his passions is software programming. He does not develop this software as an Istat representative but as an independent developer. “I develop myself all my apps, A to Z, taking care of all related aspects”, states Sandro.

“One important message is that the programmer has to listen to users, also if they ask for a completely different data display or options during all the app’s life-cycle steps.”

The architecture that Sandro exposed to Codemotion Rome 2019 follows the same path he applies in all his software projects. This is an important standpoint: in his opinion, anyone with basic technical skills can make his own software products, using the software architecture he proposes, or another one very similar to it.

The basic pattern is choosing open data sources, deriving from them an educated set of useful data to be displayed on smartphone’s screens. Bringing a selection of data on mobile devices is very useful, otherwise, the related knowledge would only be accessible on larger desktop screens, much less handy than smartphones.

“As a technologist, I think it is important to create applications for mobile devices that help people better understand the things that surround us”, explains Sandro.

“The purpose of my apps is to connect people with events that happen in the real world.”

Sandro Stancampiano, Technology at Istat, exposing his project at Codemotion Rome 2019

In this case, Stancampiano gives strong decision support information to both public and private building managers. Having an updated list of all seismic events in your area of responsibility can strongly help you to make correct decisions. The importance of this kind of information is normally underestimated. Most managers don’t even think that following the seismic activity can help program maintenance of any building element (streets, bridges, underground, buildings etc.), avoiding most of the catastrophes through correct planning.

The interest in this kind of information scales down to the single householder, being a source of interesting information such as the weather conditions.

Sandro has developed this app in two versions, one for Italy, one for the States. They are currently downloadable for iOs-based devices, such as the iPhone and the iPad; the porting to Android-based devices will be uploaded as soon as possible.

Let’s now go behind the scenes of Sandro’s app, “Earthquake Notifications Maps Real-time events from INGV”, Italy’s National Institute for Geophysics and Volcanology.

The app market is the right place

The first point of any business is to choose the target device. Sandro decided to work on really portable devices as the result of simple market analysis: small devices are used from a large audience; the small screen space is a demanding challenge for the programmer. There is the need to cluster data in a deeper way than on large screens, and there is the need for user’s need. Both these issues bring to a far better result. A data-driven app is obviously a consequence of quantitative market analysis.

Based on data provided by Osservatorio Mobile B2c Strategy, School of Management of Milan Polytechnic School, 31 million Italians access the internet every month from a mobile device, as of Feb 2018. Many of them use both mobile and desktop devices, but as many as 11 million of them only use a mobile device (smartphone or tablet) to surf the internet. What’s more, they spend 88% of the connected time using apps. That’s why the app market has to be considered as the most relevant target.

Screenshots from the Italy’s Earthquake Notifications app

Mashupping different data sources

New services must grab, mashup and synthesize many different and relevant big data source. Data must be then squeezed into the target device screen.

Data collection is basically taken from ISTAT’s and INGV’s public databases in Sandro’s app. Data is published according to open data rules and frequently updated. Wikipedia can also be an easy data source to grab data from. You have to take into account any different kind of licensing.

“Another useful service for my application is the Geocoding API, providing longitude and latitude data”, adds Sandro. This is a webservice powered by Google. Basic access is given by two parameters, daily quota and sleep time. The daily request quota is limited at 2,500 free requests per day, with a maximum of 50 requests per second. A sleep time of n milliseconds at each iteration is added, so too many HTTP calls can cause problems.

Geocoding constraints can ask for attention in requesting data: you could easily be blocked, should you query the database following an inappropriate pattern.

Coding is easy. Let’s see the case for adding geographic coordinates:

$xlat = $jsonDecode -> {'results'}[0] ->{'geometry'} -> {'location'}->{'lat'};
$xlon = $jsonDecode -> {'results'}[0] ->{'geometry'} -> {'location'}->{'lng'};
$sql= "UPDATE zns SET latitudine = '$xlat', longitudine = '$xlon' WHERE regione = 'Lazio' AND provincia = 'Rieti' AND comune = '$comunescape'";

Full-stack developing

It’s easy to move through many different software solutions, such as Python, Java, Php, Swift, (My)SQL, Postgres, Json, Html, XML, Gpx — the GPS exchange format — and more. A large part of the work is done inside the app. In this case, in order to provide data for the app, you have to parse GPX data in the app and parse JSON data.

Sandro uses Swift as the language for the app’s user interface. Current versions of Sandro’s apps are meant for the Apple market, including the iPhone and iPad product families.

Code reuse

A good architecture can be easily re-used for different purposes from the first one. Sandro shows how to use a different big data database, created by the USGS (United States Geological Survey), to show the most recent earthquakes recorded in the United States.

--

--

Codemotion

We help tech communities to grow worldwide, providing top-notch tools and unparalleled networking opportunities.