1 Introduction

The large-scale use of smart devices connected to the internet has transformed several aspects of the way we live. In a smart home, for example, the implementation of IoT devices can offer more security and energy efficiency. Health monitoring devices can provide greater independence for the elderly and people with disabilities. Smart IoT traffic systems, vehicular networks, and sensors embedded in roads minimize congestion and accidents in a smart city.

However, IoT applications require an environment with support to mobility and geographic distribution, in addition to location recognition and low latency, characteristics often not present in the cloud computing. To meet these requirements, a platform called Fog Computing is proposed by [3]. Fog computing, in turn, is a virtualized platform that provides computing, storage, and networking services between edge devices and cloud computing data centers.

Most of the data generated by IoT applications require time-sensitive processing and, therefore, it is increasingly common proposals that aim to solve the challenge of generating responses in an acceptable time or delay. The requirements present in IoT applications such as low latency in communication, data stream processing, or fast execution and response have been presented as requirements of an application with a temporal nature, which generates multiple concepts applied to real-time systems. Data stream, in turn, can be conceptualized as continuous, infinite, fast input data with a variable time sequence [23]. In addition, solutions that use this type of data tend to have variations in execution time and, therefore, unpredictability in response time estimates.

Therefore, in this article, we propose a model and a computational architecture for an IoT environment with a configuration in Fog computing. The goal of our proposal is to implement a health monitoring environment in order to monitor and analyze data processing and presentation times and delays. This allows us to indicate time constraint so that the system is able to execute near real-time, that is, within an acceptable time and/or delay according to the characteristics and requirements of the environment and the application.

The paper is organized as follows. In the Sect. 2 some concepts related to research are presented. In Sect. 3 we list some related works. Our proposal is presented and described in Sect. 4. The initial results of the implementation of our proposal are presented in Sect. 5. Finally, the final considerations and indications for future works are presented in Sect. 6.

2 Overview

In this section, we present an overview of healthcare, fog computing, and real-time processing, in order to provide the concepts covered in this article.

2.1 Healthcare Environment

Healthcare is a smart environment where a health and context monitoring system is set up. It provides e-health services to monitor and evaluate the health of assisted users, which can be elders, people with disabilities, children or patients. The health monitoring of these users is carried out by specialty users such as doctors, nurses or caregivers.

The healthcare environment configuration is composed of three main components: sensors, communication, and processing system [18]. Sensors are deployed in environments or user accessories such as belts, clothes, glasses, and they are responsible for data acquisition. The acquired data by sensors are transmitted through an access point or base station to a server or portable devices via network communication technologies. The data are stored, processed in the server and presented to specialty users so that they can act in case of abnormality or emergency.

In the next subsections, we presented some conceptions e characteristics related to sensors implemented in a healthcare environment.

2.1.1 Sensors

Physical sensors are the most common types of sensors in a healthcare environment and are responsible for collecting data about user physiology and user environment [15]. There are three main classes for monitoring the assisted user and the environment: Personal Sensor Networks, Body Sensor Networks, and Multimedia Devices [18].

  • Personal Sensor Networks (PSN): usually are sensors deployed in the environment whose goal is to detect daily activities of human and to measure environmental conditions.

  • Body Sensor Networks (BSN): composed of sensors embedded in personal accessories such as clothes, belts or glasses. These sensors have the role of monitoring vital signs and health conditions of the assisted user [30].

  • Multimedia Devices (MD): are audio and video devices responsible for monitoring the movements and promote greater interaction between the assisted user and the healthcare application.

The data collected by sensors can be classified according to the frequency of their receipt in three types of events: constant, interval and instant.

  • Constant: the data are transmitted continuously.

  • Interval: the data are transmitted periodically, following a uniform time interval.

  • Instant: the data are instantaneously transmitted when an event occurs.

2.2 Edge Computing and Fog Computing

According to [25] Edge Computing is a paradigm in which the resources of communication, computational, control and storage are placed on the edge of the Internet, close to mobile devices, sensors, actuators, connected things and end users. An Edge device is not a datacenter neither a simple sensor that converts analog to digital and collects and sends data. An Edge device can be conceptualized as any computational or network resource that resides between data sources and cloud data centers.

On the other hand, Fog computing can be conceptualized as computational elements intermediates, located between Edge devices and cloud, which typically provide some way of data management and communication service between Edge devices and cloud [12]. The main goal of this intermediate layer is to reduce the latency and response time since data do not have to reach the cloud to be processed.

Bonomi et al. [3] present temporal requirements of Fog computing environments. They defend that some data generated by the sensor and device grid require real-time processing (from milliseconds to sub-seconds). All interactions and processes occur throughout the Fog computing environment are seconds to minutes (to real-time analyses) and until days (transactional analyze).

Despite its increasing use, Fog computing is often called Edge computing. However, these approaches have key differences [12]:

  • Fog computing has hierarchical layers while edge tends to be limited to a small number of layers;

  • Unlike the Edge, Fog works with the cloud;

  • Beyond computing, Fog also covers network, storage, control and data processing.

2.3 Real-Time Processing

With the advent of Big data and the use of data stream, the concept of real-time presented in most current researches has distanced from the one proposed in the classical literature. The survey of Gomes et al. [9] presents a classification of articles that propose the use of the real-time approach in big data environments that use data stream. It can be noted that most articles use the term real-time as fast response and low latency.

In this article, we consider the concept presented by [4, 24, 26], which define that a real-time system depends not only on the logical result of the computation but also the time in which the results are produced. For authors, it is a common misconception to consider only fast computation to a real-time system, since the purpose of these systems is to meet the temporal requirements of each task.

Therefore, the network is considered a component that is directly related to the quality of service offered by the systems [29]. For this reason, it is considered one of the factors that most affect the performance of operations [5], which makes it a challenge for distributed systems, such as healthcare, to meet temporal requirements.

3 Related Works

In this section, we present some studies that address the use of Fog Computing for Healthcare monitoring.

Nandyala and Kim [19] propose an IoT-based real-time u-healthcare monitoring architecture. The proposed architecture makes use of the advantages of fog computing to take advantage of the proximity between processing and the devices and thus provide real-time monitoring for smart homes and hospitals.

Bhargava et al. [2] research presents a low-cost Wireless Sensor Networks (WSN)-based system for monitoring real-time mobility and outdoor positioning of older adults with Alzheimer’s. The purpose of monitoring is to detect anomalous behaviors and decrease the risk of the elderly to wander. Real-time data analysis is performed on the wearable device itself using the Fog Computing approach.

Verma and Sood [27] propose remote monitoring of the health of smart home patients through the use of the concept of fog computing. The model uses advanced techniques and services such as embedded data mining, distributed storage, and notification services for network devices. In addition, it uses event-based data transmission methodology to process patient data in real-time at the fog layer.

Nguyen Gia et al. [20] propose a system for continuous remote monitoring of IoT-based healthcare and fog computing. The objective of the proposed system is to improve disease analysis and diagnosis accuracy with health (blood glucose, ECG, temperature) and context (ambient temperature, humidity, and air quality) data. An encryption algorithm is applied to the system to protect the collected data. The data is then encrypted on the sensor nodes before being transmitted and decrypted on smart gateways.

Vilela et al. [28] proposes a health monitoring, evaluation, and performance demonstration system based on the fog computing approach. The goal of the system is to minimize data traffic at the core of the network, improve information security and provide quality information about the patient’s health status.

The aforementioned articles propose an architecture for remote health monitoring, with fog computing configuration to provide fast data processing and presentation. Therefore, they are different from our proposal, since we intend with our research to present the processing and data presentation times to indicate time constraints for the system to run near real-time.

4 Data Processing Model for a Healthcare Environment

In this article, we propose a computational model and architecture for a healthcare environment based on a fog computing configuration, so that it is possible to process and present the results near real-time.

We understand that a system processes near real-time when it presents acceptable times and/or delays, according to the characteristics and requirements of the base application. We can conceptualize systems with processing near real-time as those that feature the high response sensitivity [21], or that process the data immediately after its input in the system [14].

As we previously proposed in our article [6], the basic infrastructure of the health monitoring environment is composed of the layers of edge computing (data providers), fog computing (processing and presentation of data), and cloud computing (persistent storage of data).

A health monitoring environment is composed of context sensors (inserted in the environment), personal sensors, and wearable sensors (remains constantly with the user). Our proposal consists of inserting a cloud service of data storage in each residence in order to build the fog computing environment, that is, the data processing environment close to the data source.

Therefore, as can be seen in Fig. 1, assisted users’ homes are configured as different fog computing that transforms, process and presents the data received by the sensors and send it to the cloud computing, represented by the hospital. Once the data is stored in the cloud computing, it can be accessed by medical doctors and/or nurses to obtain the patient’s history. Information on the patient’s current situation is obtained remotely through tools contained in the fog computing environment.

Fig. 1.
figure 1

Fog computing structure for a healthcare environment

Based on the health monitoring environment presented, we propose a layered computational model that presents all the necessary steps for data transformation, processing, and analysis.

As shown in Fig. 2, the proposed model consists of six layers. The first layer consists of the data source from the IoT devices (Data Source). This data is sent to the ETL layer, which is responsible for extracting, transforming and loading the data. After the data transformation has been carried out, they are sent to layer three, which represents the Data Processing step, which, when finalized, is sent to the storage layer (Data Warehouse). After the data storage stage is finished, it is possible to perform an analysis of the system performance, using metrics data obtained by specialized software (Analytics). Finally, the information of the assisted user and the system are presented to the responsible user through graphs and tables (User Interface).

Fig. 2.
figure 2

Computational model for processing IoT healthcare environment

Based on the proposed model, Fig. 3 presents the proposed architecture for the IoT environment for health monitoring. The objective of the architecture is to indicate specialized tools that provide efficient results because according to [7] the correct and structured use of tools determines positively the correct use of the data.

Fig. 3.
figure 3

Computational architecture for processing IoT healthcare environment

The proposed architecture consists of the layers proposed in the model and tools used to implement the health monitoring platform in fog computing.

  • Data Source: layer responsible for receiving data from sources such as sensors, vehicles, smartphones, smart homes, and smart watches.

  • ETL: responsible for data extraction, transformation, and loading. For this step, Apache Avro [1], a data serialization system, was used.

  • Processing: layer responsible for processing the data stream. It was used Apache Kafka [13], a distributed messages platform based on publish/subscribe model.

  • Data Warehouse: responsible for local data stream storage. The InfluxDB [11] is used on the platform because is a optimized temporal series data base to be fast, and has high storage availability and data recovery.

  • Analytics: layer responsible for obtaining system performance metrics, in order to enable the analysis of end-to-end processing times and delays. The tools used were Kafka-Monitor [16] and Prometheus [22]. The first is an open-source deployment by a group of Kafka experts of Linkedin and is responsible for obtaining the end-to-end metrics of Apache Kafka. The second, on the other hand, is used to store the received metrics and generate the visualizations, allowing the monitoring of the system and generating event alerts.

  • User Interface: layer responsible for presenting the data to the end-user. The tool used was Grafana [10], a web application that allows data to be viewed remotely through tables and graphs.

Based on the proposed model and architecture, we implemented the health monitoring environment and generated the first results, which are presented in the next section.

5 Environment and Experimental Results

This section presents the results obtained by implementing the proposed model and architecture. First, we describe the computational environment used to implement the architecture. Then, we present, as a first result, reports that show the user’s current health situation and generate warnings for abnormal situations.

5.1 Environment

The environment used to carry out the experiments can be divided into 3 parts: hardware, software, and sensing environment. To compose the hardware environment we use a Desktop with Ubuntu 18.04 LTS, Core i7 processor, and 16GB of RAM. The software and sensing environments, we use the ones proposed by Gomes et al. [8].

The software environment runs on Docker and contains the tools present in the architecture proposed in this article, in addition to the MQTT Broker, responsible for receiving publish/subscribe messages which use MQTT protocol [17] and send them to the next level.

The sensing environment is composed of 9 sensors, divided into 3 categories: environment, personal, and health.

  • Environment Sensors: comprise temperature and humidity sensors. With the data from these two sensors, it is also possible to obtain the thermal discomfort index.

  • Personal Sensors: are the location, gyroscope, and accelerometer sensors. They are used to obtain the user’s location, as well as his/her position (lying, sitting, or standing) and his/her movement (standing, running, or walking). This data makes it possible to know if the user is active or suffered a fall.

  • Health Sensors: they are the wearable sensors EGC, Pulse Oximeter, Blood Pressure (systolic and diastolic), and body temperature. The data obtained by this set of sensors, associated with data from personal sensors, for example, can provide information that the user’s body temperature is high because he is performing physical activity.

After implementing the environments, we created a dashboard for generating alerts regarding the current health of the assisted user. The graphs are presented in the next subsection.

5.2 Experimental Results

For the generation of the reports, we use synthetic data generated randomly from a JSON script. The data, for this experiment, is produced every 10 s, making the system receive the data continuously simulating the generation of the data stream.

Figures 4 and 5 show the reports of the environment and wearable sensors, respectively.

Fig. 4.
figure 4

Environment sensors report and warnings

Fig. 5.
figure 5

Wearable sensors report and warnings

As we can analyze, reports are generated with the data captured by the sensors (left side of the figures). In addition, alarm reports are generated to notify that the data obtained has abnormalities (right side of the figures). We can analyze in Fig. 5 that the electrocardiogram alert report has no data, which means that the user is well, that is, he/she is neither with bradycardia nor with tachycardia.

6 Conclusions

In this article, we proposed a computational model and architecture based on a distributed environment, such as IoT, with fog computing configuration. We use the concept of a health monitoring environment as a basic application. The goal of our proposal was to structure a healthcare environment in order to allow the utilization of tools that enable the correct and efficient use of data. Additionally, with our proposal, we intend to monitor the environment so that it is possible to indicate time constraints, in view of the time-sensitivity in data processing present in healthcare environments. Considering the unpredictable characteristic of an environment distributed as IoT, we present in this article the approach of executing data near real-time. In other words, we proposed to comply with the deadline in a better effort, that is, the data being executed immediately after its input.

We implemented the proposed architecture and obtained preliminary results that consisted of generating a dashboard with constant visualization of the health reports of the assisted user. Through graphs and tables, it is possible to monitor the current situation of the user, as well as to display a warning when the data is not in conformity with the abnormality.

As future work, we intend to improve the visualization of reports and the generation of alerts. In addition, we intend to install the monitoring tool (Kafka-Monitor) so that we can obtain information regarding latency, delays, and system performance. With this information, we will then be able to indicate time constraints and verify the system’s performance faced with the time requirement.