Fog-based Remote in-Home Health Monitoring Framework

As a result of what happened to the world during the past and current year of the spread of the Covid-19 epidemic, it was necessary to have a reliable health care system for remote observation, especially in care homes for the elderly. There are many research works have been done in this field, but still have limitations in terms of latency, security, response delay, and long execution times. To remove these limitations, this paper introduces a Smart Healthcare Framework called Remote inHome Health Monitoring (RHHM), which provides architecture and functionalities in order to facilitate the control of patients' conditions when they are at home. The framework exploits the benefits of fog layers with high-level services such as local storage, local real-time data processing, and embedded data mining for taking responsibility for handling some burdens of the sensor network and the cloud and to become a decision maker. In addition to, it incorporates camera with body sensors in diagnosis for more reliability and efficiency with privacy preserving. The performance of the proposed framework was evaluated using the popular iFogSim toolkit. The results show the proposed system's ability to reduce latency, energy consumption, network communications, and overall response time. The efforts of this work will help support the overall goal to establish a high performance, secured and reliable smart Healthcare system. Keywords—Fog computing; health monitoring; iFogSim; IoT; cloud computing


I. INTRODUCTION
With the increase in number of patients (like elderly people) living home alone under supervision of their doctors, it becomes necessary to add a facility for monitoring them remotely as the patient must be diagnosed for rapid intervention [1]. Moreover, some patients may have difficulties in reporting their pain condition for being impaired or disabled. Also, contagious diseases patients cannot communicate with others directly as Covid-19 patients. For such cases, smart healthcare systems represent urgent need. These systems used the technology to monitor patients at their homes or hospital and notify their doctors, caregivers or family individuals with their health status and demands [2]. These technologies involve IoT, cloud computing and fog computing.
IoT technology integrates hardware, computing devices, physical objects, software, and people via a network enabling them to interact, communicate, collect, and change data and actions are taken. Incorporating IoT technologies and healthcare improves the quality of healthcare systems.
Previous works have decomposed the architecture of IoThealthcare system into three layers as depicted in Fig. 1 [3,4,5]: 1) body sensors that aggregate the data from the patients and the surrounding environment to be available for doctors, caregivers or authorized persons anytime and anywhere, 2) Fog gateways to receive and preprocess the sensor data, making some operations on data, and 3) cloud data center for storage, processing and analysis of data [4].
Cloud computing provides on-demand services to its users via internet in any place at any time. However, it is not adequate for meeting the requirements of rapid growth of IoT services, e.g., scalability and latency. It also has many negatives, such as: latency, network congestion, link disconnection and delayed response, in situations where the patient life may depend upon. So, fog computing can be the appropriate solution to collaborate with the cloud to fulfill the needs of real-time IoT services. Fog layer is an intermediate layer between sensors and cloud for data pre-processing, data analysis and storage rather than the cloud [6]. Fog gateway uses network switches, routers, smartphones, or embedded devices near the patient to provide cloud services with minimum latency and response time. Healthcare monitoring systems in the literature comprise to two approaches: sensor-based and camera-based systems. Sensor-based approach uses the body sensor readings to diagnose patient status while camera-based depends upon capturing the patient image to analyze his emotions and body gestures. Each approach has its merits and its demerits according to the application and the objectives. This paper incorporates the two approaches in order to exploit the advantages of each in patient diagnosing whether the pain can be diagnosed by sensors only or not as the diagnosis of internal medicine, teeth pains, bones and muscles pains and headache. The later health problems can be diagnosed efficiently using pain detection approaches rather than using sensors only.
In this paper, we introduce a smart fog-cloud based healthcare monitoring framework that uses both sensors and cameras for maintaining its various functionalities. The main contributions of our work are summarized as follows: • Proposing a smart remote in-home healthcare monitoring system.
• Incorporating camera with body sensors in pain diagnosis for more reliability and efficiency, and for diagnosing non detected health problems such as internal medicine, teeth pains and so on.
• Taking advantages of the features of fog computing at which we add the decision maker that uses local data processing.
• Performance evaluation of the proposed fog-based system by using iFogsim toolkit. This paper is framed in different sections. Section 2 introduces background and related work. The proposed framework is presented and explained in Section 3. Section 4 discusses the experimental results. Finally, Section 5 concludes the paper and suggests future works.

II. BACKGROUND AND RELATED WORK
The fog computing is a new paradigm in healthcare monitoring systems [6]. It can play a major role by its ability to perform data processing which preventing network congestion and reducing the amount of transmitted data. Most of the recent studies [7][8][9][10][11][12][13][14][15][16][17] in remote healthcare systems focus on using body sensors to monitor the patient status and provide the assistance to them. These sensors can be positioned on or embedded inside the body to measure certain signs of the patient. A specialized device is usually used to collect the data received from these sensors and is responsible for communicating them to the monitoring device. However, only few papers exploit using the camera to explain the emotional state of patients and analyzing it. According to that, healthcare related work will be discussed in the following two separated subsections where the first summarizes the usage of fog in healthcare and the second summarizes the usage of cameras in healthcare.

A. Fog Computing in Healthcare
Verma and Sood [7] introduced a fog layer for augmenting health monitoring system. They reduced the amount of data transmitted to the cloud by developing an event triggering mechanism which transfers the patient vital data in unsafe status only. Ahmad et al. [8] proposed a healthcare framework called HealthFog which concentrated on the data privacy in healthcare systems by integrating a cloud access security broker with the system in addition to cryptographic primitives. Nandyala and Kim [9] proposed an architectural view of a healthcare system known as IoT based u-healthcare monitoring system. This architecture exploits the advantages of fog computing which interacts more by serving closer to the edge at Smart Homes and Smart Hospitals.
An enhanced cloud-based Fog computing system is proposed by Gia et al. [10] where bio-signals are analyzed at the fog server side for real time applications. Negash et al. [11] concentrated on a smart e-health gateway implementation by connecting a network to such gateways, both in home and hospital use. Rahmani et al. [3] exploited the smart e-health gateways in healthcare IOT systems where the fog layer is between sensor network and cloud. A prototype of a smart ehealth Gateway is presented for implementation and also an IoT-based Early warning score (EWS) health monitoring is implemented. Shree and Padmavathi [12] considered a fogbased scenario where the vital signs are collected from the patient, filtered, processed and take decisions at the fog layer.

B. Camera-based Systems in Healthcare
Mano et al. [4] developed a health smart home system based on the use of face image in patient identification and expression recognition. The authors in [13] observed the agitation in the sedated patients by installing the camera in the intensive care units. Banerjee et al. [14] proposed an approach for patient activity recognition in hospital beds using Kinect sensor. A non-invasive system for monitoring the newborns is presented by extracting and processing of motion signals, from multiple digital cameras, to estimate the periodicity of pathological movements using the Maximum Likelihood criteria [15]. Sun et al. [16] developed a video-based method for automated detection of the infants' discomfort. Chaichulee et al. [17] proposed an approach for detecting the presence of the patient and extracting cardio-respiratory signals from the patient skin with no clinical intervention using a video camera. A hybrid framework, in human behavior modeling in ambient assisted living systems, is proposed by Patel and Shah [18]. They added new events and behaviors and classified them into normal or abnormal human behavior by using camera images.

III. PROPOSED FRAMEWORK ARCHITECTURE
In this section, we describe the main architecture of the proposed framework, called Remote in-Home Health Monitoring Framework (RHHM). Fig. 2 illustrates the proposed framework architecture for remote patient monitoring, that is composed of three main layers: Sensor Network (IoT), fog and cloud layer. 248 | P a g e www.ijacsa.thesai.org The following subsections demonstrate the details of the three main layers of the framework.

A. Sensor Network Layer
To collect the patient information that reflects his activity and medical state, several types of sensors are needed such as medical sensors, activity sensors, environment sensors and smart cameras constituting sensor network layer. Medical sensors include Electro Cardio Gram (ECG) sensor, Electro Encephalo Gram (EEG) sensor, Electro Myo Graphy (EMG) sensor, pulse oximeter sensor, temperature sensor, respiration rate sensor and glucose level sensor. Sensor's elements are responsible for detecting the presence of the patient, capturing his image, collecting readings and sending it to the fog devices via wireless or wired communication protocols. Sensors must be in all positions that the patient can move to it.

B. Fog Layer
Fog layer consists of multiple distributed smart devices or nodes, called gateways. A gateway is a device with computing, storage and network connectivity that is distributed near to the sensors which produce the data. Fog nodes handle four issues: 1) receiving patient data from sensors, 2) analyzing these data to make a decision of the health state of the patient, 3) communicating with caregivers, and finally 4) passing the data to the cloud. Local data processing is added to the fog for adding the intelligence to it in order to enhance the system by increasing its reliability, decreasing latency, overcoming the internet disconnection and speedup the decision especially at emergency situations. Fog layer has many functions and properties as followed: 1) Data collection module: This module can collect the physiological and environmental data from various wireless sensors embedded at different locations at home and from elderly patient and convert it to adequate form for analysis. Data filtering, preprocessing and noise removal are implemented in this module.
2) Patient identification module: This module is responsible for determining the identification of the patient via biometrics as face recognition, Iris recognition and finger print. However, face recognition is the easiest, fastest, cheapest and most reliable approach whereas it defines the patient identity and his emotions from videos or images, robust in different lightening conditions, able to work with faces from different angles and the camera and mobiles are available in anywhere. Face recognition consists of three steps: face detection, feature extraction and face recognition [19]. Face detection step decides if the captured image contains face or not. If it contains a face, it detects and specifies the face location in the image. Feature extraction includes extracting the features from the detected face by one of the two categories: appearance based or geometric based techniques [20]. Finally, recognition step compares the feature vector with all the stored vectors in the face database to decide the face identity by using machine learning classifiers. Fig. 3 shows the general steps of the face recognition process. 3) Patient pain recognition module: this module is incorporated in the monitoring system to detect and measure the pain of the monitored patient. The pain can be detected through two methods: the first uses the vital signs as temperature, blood pressure and blood glucose which are collected from the wearable sensors that reflect the vital measures of the body. The second method uses the facial expressions to determine if the patient has pain or not and the degree of pain. Facial expression recognition is beneficial at the healthcare frameworks because it reflects the patient health status and emotions [4,21]. It also helps the system to define the pain from diseases which do not have a device that reflects it directly such as: headache, teeth pain, and internal medicine pains. Taking a picture of a patient face periodically can give an idea of to what extent the patient is feeling pain and can enable a caregiver to decide whether help is required or not. Also, patient emotions are important factor during diseases treatment and diagnose of various diseases such as: schizophrenia, depression, autism and bipolar disorder. This module classifies the pain degree according to both facial expression and vital signs. The pain classification according to facial expression is depicted in Fig. 4. 4) Data security module: As the patient data can be vulnerable through being transmitted from a gateway to the cloud, the security and integrity of these data are essential requirements that must be considered in designing healthcare frameworks. Therefore, encryption and watermarking techniques as important components in secured healthcare frameworks are introduced by this module. Encryption is the process of converting data to an unrecognized form to protect it from unauthorized people. Furthermore, watermarking is the procedure of hiding information within an image without distorting the visibility or credibility of it. The data security module in our proposed framework aims to hide the patient data when stored in the fog local server or transmitted to the cloud server by first watermarking the sensors data of the patient into the patient face image, then using a proper encryption algorithm the watermarked patient face image is concerted into a cipher image that cannot be read except by the authorized parties as depicted in Fig. 5.

5) Local storage module:
The gateway should have a private local storage which stores the incoming data on a local repository to perform functions as data security and data analysis. Moreover, the data that could not be transmitted to the cloud due to network problems is stored temporally in the gateway.
6) Notification module: This module is responsible for sending alarms to caregivers and family persons if an urgent situation has occurred to the patient. It also tells the patient if an action is required; time of medicine, quantity of medicine, a specific food must eat, and any other desired instructions to follow. The notification may be a message, voice telephone call or voice over IP (VoIP). NG112 architecture is an example of VoIP that enables the modernization of emergency communications, allowing for far more data collection (text, video, location or additional data), which will result in a more efficient response [22]. NG112 also helps to ensure equivalent access for all citizens, including people with disabilities.
7) Data analysis module: This module is responsible for making decisions at fog layer in situations that need the fast intervention. The decision must be carried out by gathering information about the patient such as: age, weight, height and current diseases. Moreover, it receives the sensor data and applies machine-learning algorithms to decide if an emergency situation has occurred to send a fast alarm and send the collected data to the cloud. If the data does not contradict the patients expected behavior or health, the decision maker module does not take any action and no data will be transmitted to the cloud storage.
A generalized algorithm is proposed for decision-making and notification based on camera face image and vital signs such as body temperature, blood pressure and blood glucose percentage. The proposed algorithm is illustrated in Algorithm 1. The algorithm starts with determining the threshold of each reading such as pain_score, temperature threshold, blood pressure, blood glucose percentage. Sensor data is sent to the machine-learning algorithm. This data is then analyzed to determine the action to be taken as shown in the selection structure (IF statement) of Algorithm 1.

8) Data compression module:
The patient data must be sent to the cloud for storage, diseases prediction, risk amount assessment and long-term analysis. Huge amount of data is sent periodically to the cloud which cause network congestion, latency and it needs a large space for storage. Image compression deals with the previous problems. There are two types of image compression algorithms; lossless and lossy methods [23]. Medical image as in our work must use the lossless methods because any loss of the information in the original image can result in improper diagnosis and risk assessment. Lossless compression is decomposed of two steps. The first step: transforms the image to another format. The second step uses an entropy encoder to remove the coding redundancy [23].

C. Cloud Layer
Cloud layer consists of distributed resources, repositories and servers that are located at far place. These devices are managed by a cloud manager that integrates them to receive process and store the patient data. The doctor/caregiver can use these data to fulfill long-term analysis evaluating the status and history of patient health. It is responsible for the following functions: 1) Big data storage: The data gathered from sensors, after being analyzed at the fog layer, is transmitted to the cloud storage which provides enormous amount of storage for saving large healthcare data files. The healthcare data is available to doctors, caregivers, hospitals and assurance companies for further various usages. 2) Big data analysis: It helps in analyzing all patient data (such as images, symptoms, therapy plans and treatment) and makes all the data available to support and improve long term clinical decision-making processes, treatment and medical research. Machine learning algorithms, predictive algorithms and data visualization algorithms can be conducted on these data to get more insights form these data.

Input: Real values from Camera and sensors
3) Diseases Prediction: Based on patient information such as: age, height, weight and historical diseases in his family, this unit is responsible for the expectation of the diseases which the patient can possibly incur in the future. It uses machine-learning algorithms to compute the percentage of the expected diseases based on the correlation of the accepted vital signs as simply shown in Algorithm 2. 1) The fog device receives the patient face image from the camera or mobile phone. Then, the fog device either continues its work or does nothing according to the decision of recognition phase.

IV. DATA FLOW OF THE PROPOSED FRAMEWORK
2) If a pain is detected from the face expressions or unusual body activity, it alerts the data analysis unit to integrate with sensor readings.
3) Data analysis is accomplished on sensor readings. Data filtering is applied to the received sensor data to remove the noise, electromagnetic interference and improper attachments of sensors. Then, it analyzes the filtered sensors data to assist the system in diagnose the patient situation. 4) The system notifies responsible persons about the patient health status if an emergency situation is occurred.
5) The patient data is forwarded to be stored at the cloud for future needs. This data is hidden in the patient image. Then, image is encrypted and compressed.
6) The system saves a backup of patient's health data locally in case of a connection problem with the cloud.
V. DISCUSSION Improvements in using the fog-based framework against cloud based only for remote pain monitoring will be illustrate in the experimental results. To validate the effectiveness of the proposed fog-based framework, the results are compared to the cloud-based framework for health monitoring. The comparison is accomplished in terms of energy consumption, latency, network usage and response time. The results of the simulations are performed on different scales confirmed the effectiveness of the proposed framework compared to the cloud based one. Also, we briefly compare the proposed framework to the existing healthcare frameworks as shown in Table II. To the best of our knowledge, none of the existing systems uses both the face emotions and pain detection in patient identification together.
From Table I, it is obvious that the proposed framework exceeds its predecessors in different aspects. Considering suitability as tool for simulating applications, iFogSim [24] was employed to evaluate the proposed RHHM framework by using the basic functionalities such as datacenters and cloudlets. As first simulator of IoT objects, it connects to the fog devices and cloud in a hierarchical manner [25].

A. Model Building
The simulation is accomplished with four types of fog devices. Four physical topology configurations of a monitored home are conducted to obtain accurate results: config1, config2, config3 and config4 which represent homes composed of one room, 2 rooms, 3 rooms and 4 rooms to be monitored, respectively as in Fig. 7. Each room is equipped with 2 smart cameras monitoring the areas, temperature sensor and pressure sensor, in addition to ISP gateway. The whole home has a WiFi gateway which transmits data to the cloud. Smart cameras transmit live video streams to the mobile phone which recognizes the patient and in order to send to ISP Gateway. Smart phone has 1GB RAM, 1GHz CPU and needs 87.53 W of power while ISP Gateway has 4 GB RAM, 2.8 GHz CPU and needs 107.330W of power as the WiFi Gateway but the cloud has 8 GB RAM, 4 GHz CPU and needs 1648W of power. Table II shows the latency from each fog device to another in a hierarchy manner. Through the conducted experiments, two scenarios were evaluated as depicted in Fig. 8: the first one is cloud-based RHHM where the sensors including smart cameras send their readings to the cloud for decision making while the second scenario is fog based RHHM where the data is analyzed at the fog gateways to make the decision.  These models are evaluated in terms of work delay, energy consumption, network usage and execution time and the simulation charts are given. In the experiments, each scenario is built and evaluated individually using the following steps: 1) The application modules are constructed, which are represented by 11 squares in Fig. 8(a), and 9 squares in Fig. 8(b), as: face recognition, pain detection, watermarking, and so on with the following features: RAM=100MB, MIPS(million instruction per second )=1000, Bandwidth=1000 and VM (virtual machine) is Xen.
2) The application edges connect the application modules with each other; where each application edge is described by its source, destination, tuple CPU length, tuple network length and direction.
3) The application loops, which represent the flow of data, are conducted according to each model. Two application loops were used to represent the delay; the first loop starts from capturing images to caregiver notification while the second loop starts from data analysis model to patient knowledge with the decision. 4) Fog devices are considered. 5) Adding application modules to the fog devices as described in Fig. 8. 6) Finally, the experiment is conducted.

B. Energy Consumption
To prove our framework, we have measured the energy consumed by the different categories of devices (mobile phones, edge devices and cloud) as illustrated in Fig. 9. It is observed that the energy consumed at the mobile phones and edge devices are semi-equal at the two scenarios because the devices work periodically in the two situations. But the energy consumption at the cloud in cloud-based RHHM is higher by 8%-20% than it in fog-based RHHM, because the data analysis and decision making is implemented at the fog in fog based RHHM while they are shifted to the cloud in cloudbased RHHM. The total energy consumed in cloud-based RHHM is 9%-22% higher than that consumed in the fogbased RHHM which means that the proposed fog-based RHHM saves the energy of the system components and meet the performance requirements.

C. End to End Latency
The time from sending the data from camera, or sensors, until the result or the decision appears on the patient smart phone is recognized as the end-to-end latency. It computes the time needed to take the decision according to the patient status. It is noted from Fig. 10 that the processing time on fog devices in fog/cloud-based RHHM is very small compared to the processing on the cloud in cloud-based RHHM. The latency also increases as data transmission increases resulting from the number of rooms under consideration. The average latency is reduced at fog-based RHHM by 97% than that at the cloud-based RHHM.
(a) Cloud based RHHM.    Fig. 11 shows the network usage at the cloud and the fog. It is obvious that the network time usage and the data transmitted via the network is 15% to 16% less using the fog/cloud based RHHM.  Fig. 12 shows that the total response time increases when the number of rooms increases and consequently data transmission increases due to the amount of collected data increases and the need for processing increases. The figure also shows the high contrast between the processing at fog layer in fog/cloud based RHHM and cloud in cloud based RHHM. In this work, we propose a fog/cloud based RHHM framework that moves the decision making to the fog gateways and incorporates a camera with wearable sensors in detecting some pains that cannot be diagnosed or detected through sensors only such as: internal medicine, teeth pain and headache. The framework archives the security of the patient data using watermarking and encryption algorithms. Our conducted experiments illustrate the RHHM system with various merits as enhanced overall system intelligence, energy efficiency, less network usage, and high response time.

E. Total Response Time
So that, RHHM is a good choice to be used at homes, elderly care homes, or hospitals in the near future. The framework can be improved by using alarming systems and incorporating other image analysis techniques as fall detection to improve patient status assessment.