More than 120 million people live in Mexico, and thousands of drinking fountains have been installed across the country to provide people with an efficient and first-class drinking water service. However, offering access to a safe water supply via drinking fountains across a large geographic area requires a robust technological infrastructure to ensure water availability and quality to safeguard public health.
In this article, we outline how internet of things (IoT), artificial intelligence (AI) and machine learning (ML) were deployed to develop a predictive system based on mathematical algorithms to ensure availability of water and predict the quality of the water moving through the city’s pipes. Additionally, we talk about how the predictive aspect of the system anticipates necessary maintenance services for greater supply chain efficiencies, thanks to the analysis of structured and unstructured information from official sources and measurements from IoT sensors.
Measuring water status and quality
With the objective of measuring water availability in the main urban and metropolitan areas of the country, NDS Cognitive Labs implemented several sensors that connect to the SigFox network. These mechanical sensors were focused on measuring three primary attributes of the water system: volume, pressure, and flow. With this IoT-enabled platform, data teams collected first-hand data regarding the availability of water in the different drinking fountains, pipes, and water tanks around the country. Complementing the sensors is a microcontroller and memory storage for greater system agility and reliability.
Each module locally stores the information of each water consumption event that occurs during a defined sampling interval, in this case 10 minutes, confirming that it was the right time to have an accurate reading of the data to extrapolate water usage patterns throughout the day. At the end of this interval, a report with the recorded data is transmitted through the SigFox network to a central hub and a new sampling interval is started.
Once the information from the modules is sent, the SigFox platform processes the data, including synchronization, error detection, and correction, as well as its retransmission to the NDS Cognitive Labs platform, where an Azure IoT hub endpoint is configured to receive the information.
In order to correctly receive and store the data from the SigFox platform, a configured API-KEY serves as the header of the HTTP request that is sent. The body of the data messages have the following JSON format:
Once the information is received in the Azure IoT hub, an Azure function is executed to pre-process the received data and insert it into a NoSQL database, which serves as a source of information for the predictive and analytics platform. Specifically, the system uses CosmosDB with a MongoDB Driver.
Predictive maintenance capabilities and benefits
Once this information was collected and analyzed, developer teams continued with the second challenge of the project, which is the prediction of water quality and necessary maintenance of the equipment.
In order to achieve these objectives, data teams extracted structured and unstructured information from official governmental sources, from federal, state, and municipal offices, and databases of the government office in charge of the water system in Mexico (CONAGUA), as well as from private organizations, such as independent laboratories. This information had different formats and temporalities so that, in addition to extracting information, an analysis of the information was performed to obtain the various water metrics that would enable accurate display of the quality at a specific geographic point.
The predictive function focused on predicting the maintenance of the filters and sensors installed in the drinking fountains, deep pipes, and tanks. It utilizes a linear regression model, which considers different key variables obtained by the IoT sensors, such as pressure, volume, flow, filter lifetime, water quality in the area, and operating conditions.
Likewise, with these analyses, the platform recommends the use of certain types of filters that best suit the conditions and needs of each geographical location, taking into account higher capacity, reverse osmosis, volume, pressure, quality of the water, the lifetime of the filters, among other parameters. In this way, the system provides recommendations on whether it is necessary to close a drinking fountain, give it maintenance, change or add a filter, or any other necessary repairs to ensure water quality and availability for the public
The function of water quality prediction in geographical points where there were no sensors was another challenge in reliably providing safe drinking water to the public. For this objective, development teams used the Kriging algorithm, which is an interpolation method capable of estimating variables in a geographical point with the use of data obtained from samples and unstructured information, thus obtaining the best linear and unbiased estimation with a minimum possible variance.
The system’s prediction function is based on 17 factors that are required by national and international standards: electrical conductivity, water pH, fecal coliforms, total coliforms, dissolved solids, turbidity, sulfates, fluorides, arsenic, manganese, lead, iron, mercury, chromium, cadmium, nitrates and total hardness (sum of the individual hardnesses due to calcium, magnesium, strontium, and barium ions in carbonate or bicarbonate form).
To predict the value of each of the above parameters at a point in the water delivery system where there were no samples available, machine learning models are used for each of the 17 parameters. These models were trained and stored in a reusable format that is applied during inference (prediction at a new point).
For the estimation of water quality, it’s important to not only take into account the values of previous measurements in nearby geographical points, but also information from official governmental sources, from federal, state, and municipal offices, databases from the governmental office in charge of the water system in Mexico (CONAGUA) as well as from private organizations such as independent laboratories.
By analyzing this structured information from the samples and unstructured information from governmental and private sources, the system is able to provide the most accurate measurements possible. Thanks to the use of these technologies, algorithms, and analysis, the platform achieves an accuracy rate of more than 91%, which means that the system can detect 91% of instances where there is a problem with the pipes, drinking fountains and water tanks, enabling faster and more accurate maintenance efforts to maintain the quality and availability of water to the public.
Data visualization and IAM protocols
To visualize data, various information layers are used for different purposes and personnel roles within the agency responsible for the system. Examples of the focal points of specialized displays include the drinking water quality layer, socioeconomic indicators layer (which include houses without drinking water service, without access to the electricity network, without paving, and marginalization indexes, among others), water stress availability layer, laboratories layer, drinking fountains layer and wastewater quality layer (the information of the latter is obtained in KMZ format for each established parameter and is obtained from databases of the government office in charge of the water system in Mexico). Geo-JSON format is used to render and visualize the information layers on a map platform, belonging to Google Maps.
In order to improve the user experience and the functionality of the platform, information filters are utilized, which include current water status (heavily contaminated, contaminated, bad, good, and excellent), specific information parameters, contamination radius (through the use of a heat map), information sources (depending on the different sensors) or customizable combinations of information layers.
Finally, the identity and access management (IAM) process is enabled by the Auth0 service, with different roles and types of users defined. Each role is assigned a specific set of access and permissions that allows it to access only the information that corresponds to it, thus ensuring the confidentiality of the information and facilitating the effectiveness of the platform for each role. With a vast amount of data aggregated through the system, it is important that users be equipped with the tools to filter out information that does not pertain to their specific job function.
With this project fully deployed, it is now possible to identify and anticipate when any municipality requires new filters in the water system to maintain water quality and availability. The system resulted in multiple benefits, such as reducing maintenance costs, increasing system up-time, and most importantly, ensuring safe and reliable water delivery to those in need around the city.
This project is incredibly important to Mexico as it represents the use of technologies such as IoT, AI, and ML with a predictive system based on algorithms and data science applied to something as common as drinking water. Offering, and most importantly, maintaining water supply service in drinking fountains in a city or a country requires a robust technological infrastructure in order to safeguard public health.
Gustavo Parés is the CEO and founding partner at NDS Cognitive Labs. An international technology expert and global educator, Parés leads NDS Cognitive Labs, designing and implementing digital transformation, conversational AI, and technical talent solutions. He has a Master’s degree in business administration from the Tecnológico de Monterrey, a Bachelor’s degree in administrative computing systems, certificates in management and leadership from MIT and advanced studies at Harvard and Stanford.
- What is the AI of things (AIoT)?
- Industry alliance defines platform for massive IoT connectivity
- IoT device security still neglected despite $1.5 trillion market by 2027
- How the IoT is shaping asset management solutions
- Building effective IoT applications with tinyML and automated machine learning
- Facilitating IoT provisioning at scale