Integration of IoT and Fog Computing in Healthcare Based the Smart Intensive Units

Internet of Things (IoT) has enormous capability to revolutionize medical care and enhance global health indicators in the health sector. The Intensive Care Unit (ICU) is an important part of the medical sector because it treats patients who have suffered a terrible accident, have a very serious or life-threatening condition or are undergoing an effective medical treatment that necessitates 24-hour care and support. For this reason, one of the most important issues that hospitals suffer is lack of patient monitoring systems cause ICU health attendants and doctors were overburdened, which can lead to medical errors due to a huge workload that exceeded their ability. As a result, even a minor delay in recognizing a patient’s deterioration might result in severe disability or death. Therefore, continuously patient monitoring in ICU is the most crucial process. That’s why a way to optimize the ICU monitoring procedure in order to minimize delayed detection and reduce the workload of ICU doctors and caregivers is needed. In this study, we proposed a smart IoT-based ICU patient monitoring system to help doctors and hospitals to monitor the patients continuously and in making quick decisions. Our proposed method can measure patient’s body parameters (temperature, SpO2, heartbeat, blood pressure, ECG, and it can also measure glucose, lactate, blood circulation, red blood cells, white blood cells, calcium, potassium from the patient fluids) in real-time and in case of anomalous values of the patient’s body parameters, the device will send a notification to the assigned doctor and the Emergency Care Unit (ECU) of the hospital. Doctors can also monitor the patient remotely through our system.


I. INTRODUCTION
Medical treatment is one of the basic needs of the human being. For patient care, medical field technology plays a significant role [1]. On the other hand, modern healthcare systems of ICT (Information and Communication Technologies) solutions are continuously growing through worldwide [2]. Also, the Internet of Things (IoT) devices for medical treatment is considered the revolution in the healthcare sector [3]. The intensive care unit (ICU) plays a very important role in the medical treatment field. ICU unit is a specially trained, well-equipped, isolated area of a medical facility dedicated to caring for and treating patients with life-threatening illnesses, wounds from which recovery is possible [4]. Where many types of equipment like monitoring systems for a patient, pain treatment devices, immediate resuscitation devices, breathing and cardiac support, and other life-supporting equipment etc. are all included which are intended for the patients who have been gravely injured, have a very severe or life-threatening condition or have had a major medical procedure that necessitates 24-hour care and support [5]. There are many types of ICUs: i) Aeromedical ICU (patients with acute nervous system conditions or who have recently undergone neurosurgical operations), ii) Neonatal ICU (care for prematurely born infants), iii) Trauma/burn ICU (care for patients concerned in auto accidents or have burns), iv) surgical intensive care unit (care for patients who have gone through any surgical procedure) [6].
However, ICUs have higher mortality and morbidity rates [7]. In addition, ICUs are more vulnerable to various outcomes than other healthcare systems [8]. As per a survey in [9], 87 percent of ICU patients had medical mistakes, with 15.3 percent of those mistakes resulting in negative health outcomes. Human health-related monitoring errors are the most common cause of delayed identification of ICU patients' worsening [10]. The tremendous workload experienced by ICU health workers, which is a source of burnout, has been documented in numerous surveys. The number of people who died from 265 ICU patients at Siloam Hospital Manado was 49 in 2015. One of the facts was a medical error caused by a large workload that exceeded the capacity of each employee [11]. There should be a way to optimize the ICU monitoring procedure to avoid delayed identification and lighten the load of ICU specialists. However, in such a situation, remote monitoring of a patient through IoT devices has provided a new dimension to maintaining patient welfare [12]. According to KaaIoT Technologies' recent study [13], investment on healthcare based IoT solutions will reach a strategic threshold of $1 trillion in 2025 by offering highly tailored, conveniently accessible, and efficient healthcare services to anyone.
To overcome all the mentioned issues above, we proposed an IoT based ICU patients monitoring system. The research contributions of this paper are as follows: • Real-time monitoring and analysis of ICU patient health parameters by using IoT devices. • Event classification based on fog computing for real-time response. • Real-time alert-based decision-making with information delivery to the doctor and caregivers in various situations.
There are five sections to this research. The background research of relevant contributions is described in Section 2. The proposed model's overall methodology and operating principles are presented in Section 3. Section 4 depicts the results and discussion of the study. Finally, Section 5 presents the conclusion of this paper.

II. LITERATURE REVIEW
This section summarizes recent research related to our proposed system. In the healthcare system and IoT fields, several notable contributors have greatly contributed to ICU patient monitoring.
The authors of the paper [14] proposed IoT-based system architecture for the healthcare sector, which can be beneficial in ICU, CCU, Ambulances, etc. Their proposed real-time intelligent monitoring system could collect human body parameters data from bedside monitors or other wearable devices and sensors and then analyze them. If any parameters crossed its standard limit, the system could immediately send notifications to the Emergency Care Unit and concerned practitioners. The paper [15] developed a prototype to continuously remote monitor ICU patients from home. They aimed to monitor the vital signs constantly and send an alert message to the doctor to ensure timely treatment in case of any medical emergency. Moreover, it could send patient health parameter data to the centralized server system to analyze them and generate graphical reports.
The author of the paper [16] designed a smart healthcare monitoring and measurement system to monitor numerous parameters (such as ECG, oxygen level, humidity, temperature, and blood pressure) of Covid-19 patients who required ICU care in hospitals. It was a high-level IoT cloudbased remote ICU patient monitoring platform that helped Covid patients live longer by reducing the information precision of human errors. The paper [17] described the modern health care system known as Smart ICU or EICU. It was an intelligent technology along with sensors for health monitoring and diagnosis. It showed all the patient's parameters (Blood Pressure, SPO2, ECG) and the doctor could check it in any place in the world with a simple cloud id and the internet. Even communicating through video calling was possible with the nurses or the patient. A framework of IoT monitoring system for the patients of ICU was suggested by in paper [17] to improve curative care delivery. The work addressed such concerns for well-planned monitoring of various events (and anomalies) such as health conditions, nonvital events such as medicinal data and environmental, behavioral data, and dietary information of patients with temporal associations, followed by a sensitive time alert generation system. The procedures used to develop and build a prototype monitoring system require a low-cost modular by the paper [18]. This system was designed employing low power sensors to promote quicker and good treatment in extreme situations. The IoT architecture was used to create the RESTful based Web interface to ensure platform-agnostic behavior and provides a flexible mechanism for integrating new components. In the paper [19] an IoT application was presented that uses a smart-watch to notify the doctor who was assigned to the critical unit. The wearable device improved the efficacy of monitoring at-risk patients in hospital units by allowing medical doctors to access data at any time and from any location. A wireless network was created for bio-sensing platforms to detect metabolite concentrations in patients' fluids to a smart-watch application. In the event that measured values are abnormal, inbound alarm notifications are received, requesting immediate medical care. The paper [20] focuses on the development of a competent health care IoT Based ICU Monitoring System that continuously measures the vital signs (such as temperature and pulse rate etc.) of patients admitted to ICU and sends this data to a dedicated website via the IoT system through a Wi-Fi module where the doctor could easily see their own patient data at anytime from anywhere.
The paper's [21] authors focused on applying IoT in the health care system and proposed a novel architecture of using an IoT concept under fog computing. The highlighted feature of this system was that it could provide real-time-based seamless health service in those places where the internet is not available, or the internet connection is poor. This system was also suitable for both patient monitoring and regular tracking of normal people's body parameters. The authors of the paper [22] designed a smart health care system architecture for monitoring critical patients in ICU. The system might advise and inform doctors/medical assistants in real-time about changes in vital parameters or patient movement and significant changes in environmental parameters, allowing them to take precautionary steps. These types of systems are beneficial to reduce the chance of human error caused by medical personnel such as assistants/nurses. The [23] study offers an e-health system based on the Internet of Things (IoT) and fog computing for monitoring geriatric health. The plan was created utilizing the Mysignals HW V2 platform and an Android app that serves as a Fog server, allowing for the collection of physiological and general health indicators from the elderly regularly. The elderly and their families can use this Android app to track their health, contact health care providers (administrators and doctors), and receive advice, notifications, and alarms. By assessing this system, we discover that the majority of users find it beneficial, simple to use, and learn, implying that our approach can increase the quality of aged health care. The authors of the paper [23] had only focused on measuring body parameters of ICU patients through IoT devices.
In the article [24], the authors proposed a novel architecture to provide better security, privacy, transparency in the healthcare system for patients monitoring in ICU. They used blockchain technology and cryptographic methods to tamperproof medical records and ensure data confidentiality. To reduce the communication latency in critical data processing, they used edge computing located inside the hospital. Constrained Application Protocol (CoAP) [25] and Datagram Transport Layer Security (DTLS) [26] protocol was used there to protect the precious sensor resources. In the study of paper [27], the authors proposed an IoT and machine learning-based framework to provide a better and smarter healthcare experience, especially while real-time monitoring critical patient's conditions in ICU. They used blockchain technology to ensure the security of the framework. Utilizing fog computing reduced the communication latency and made the system more robust. MeDIC (Medical Data Interoperability through Collaboration) was proposed by the paper [28], as a system in which medical equipment collaborate to translate otherwise incompatible data formats. Registration, subscribing, probing, summarising, and publishing was all functions provided by the MeDIC framework. The observation was carried out to see how effective MeDIC was in terms of data response time and uplink traffic. The suggested framework is distributed scalable, and extensible to other aspects of protocol compatibility of IoMT and other IoTrelated applications in general. In the study of this paper [29], the authors proposed a fog-assisted IoT-based patient health monitoring framework. Advanced techniques and services like as distributed storage and notification services and embedded data mining were employed at the network's edge in their system. To analyze real-time data of the patient at the fog layer, and data transmission methodology based on event triggering was applied. The temporal mining technique was applied to assess the event's adversities by calculating the patient's temporal health index.
In paper [30], we concentrate on IoT-based healthcare systems for cancer care and business analytics/cloud services and the adoption and implementation of IoT/WSN technologies to supplement existing treatment options and supply healthcare solutions. In this case, business analytics/cloud services serve as enablers for actionable insights, decision-making, data transmission, and reporting in order to improve cancer therapies. We also provide a number of frameworks and architectures to demonstrate and support the functioning IoT-based solution that is being evaluated or used in our suggested smart healthcare solution for cancer care services. Finally, it'll be critical to comprehend and explain some of the security and operational difficulties that have plagued the IoT-enabled healthcare system. The authors of the papers [24]- [30] had only focused on the data security of their IoT based ICU monitoring system.
In the paper [31], the authors worked to improve the operational process of ICU monitoring in a private hospital in Jakarta by combining IoT implementation with the Business Process Reengineering (BPR) approach. To prioritize the risks of the current monitoring process, they used the method Complex Proportional Assessment (COPRAS) to select a suitable IoT solution. Their research proposed three business process models: 1. Intelligent Monitoring Analytics 2. IoTbased Patient Monitoring and 3. a combination of both. Scenario 3 (a combination of both 1 and 2) achieved a maximum process time reduction of 37.10%. The research article [32] aimed to review IoT-based intelligent healthcare monitoring systems with their advantages and disadvantages. Besides more, the common design and implementation patterns of IoT-based intelligent health monitoring systems for patients were also highlighted here. A multi-purpose visual camera monitoring system, ADSA (Automatic Detection of Risk Situations and Alert), was proposed in [33] paper for the patients of ICU.
Based on the review of the previous studied, it can be detailed that healthcare systems still not achieve a satisfactory level because the most crucial part of security and the performance of storge data have some issues. therefore, those research have not yet been specified how the concentrated features were selected. Secondly, just using traditional systems does indicate that a model is suitable for practical implementation in the healthcare sector; rather, model customization is required to remove the overfitting and make it faster towards a clinical application. Nonetheless, this research came up with an effective solution. Integrated IoT with fog cloud are used in this study to achieve a satisfactory level and assist doctors in UCI to monitor their patient. In concluding, in attempting to explore the phenomenon of research motivations, the author of this paper seeks to improve both the understanding and knowledge of healthcare evaluation. This research made the summary of findings and limitations of the previous studied, as shown in the bellow Table 1. To reduces possibility of human errors, delay in communication and helps doctor to spare more time in decision with accurate observations. ICU's bedside monitor, Interconnection Networks, Server and Database, Cellular Phone or Personal Digital Assistant (PDA), Intelligent Software Agent They just proposed an idea but didn't work on it. They did not show any result of their work.
Reduction of the possibility of human error in case of continuous 24/7 ICU patient monitoring [15] To implement a vital sign monitoring system that continuously assesses a patient and regularly updates the same to a centralized server system and sends patient's relevant data to corresponding doctors in any medical emergency. Issues such as recordkeeping and communication will no longer be an issue because anything is feasible in Smart ICU, including video calling and interacting with nurses and patients. [17] Two significant features have been examined to improve the delivery of curative services in the Intensive Care Unit (ICU), namely (i) temporal mining for various health-related difficulties and (ii) alert creation procedure with information delivery for various critical conditions. Used biosensors, RFID-Tag recognition mechanism.
Network availability for continuous data transmission is one of the major issues. Furthermore, network load efficiency is an issue that must be addressed to make the most use of network resources.
To validate the system, it was installed in three ICU rooms for 30 days, during which almost 81 patients were tracked throughout their ICU stay. [18] The major goal of this prototype is to bridge the gap in monitoring a patient's vital signs between the ICU (after surgery or other emergency treatments) and the final hospital discharge.
One disadvantage of battery-powered devices is the need to recharge or replace batteries on a regular basis, which causes system downtime and increases operational costs. The prototype's overall security and autonomous sensor finding is not improvised.
The prototype device was briefly installed and evaluated at the Moinesti Emergency Hospital, Bacau County, in Romania. [19] The main advantage of this new approach is that the doctors, or in general the caregivers, can freely move in the hospital other structures and perform other tasks meanwhile simultaneously and constantly monitoring all the patients thanks to the technology on their wrist.
The network's utility in daily medical procedures will be tested and the security of wireless connections is not investigated far enough.
The doctor can then freely roam throughout the hospital and accomplish multiple jobs at once, all while maintaining control over the patients under his care, thanks to the suggested system. Another virtue of the system is its ability to measure a variety of endogenous and exogenous metabolites by correctly functionalizing the VOLUME XX, 2017 9 biosensors. [20] An intelligent healthcare IoT-based ICU Monitoring System was developed to continuously measures the vital signs (such as temperature and pulse rate) of patients admitted to ICU and delivers this data to a dedicated website via the IoT system via a Wi-Fi module where the doctor may view their own patient data at anytime from anywhere.
No GPS module used in the IoT patient monitoring system.
To improve the health care system, they developed an IoT based monitoring system for ICU patients. [21] To use IoT in the healthcare system under fog computing to change the current deficit clinic-centric health system to the smart patient-centric health system.

LoRaWAN,
WSN, fog computing, body area network -An energy-efficient architecture for healthcare that works well even without the internet [22] Real-time monitoring patients' vital parameters, movement, and room environment in the ICU using IoT.
Bedside monitors of ICU, XBOX KinectTM, Sensors for monitoring ICU room's environmental parameters They should be focused on data security as they work on various types of sensitive data.
They worked to eliminate unnecessary health care costs and efforts and provide medical support to critical patients at the right time. [23] The goal of this project is to contribute to the advancement of applied mobile health research.

Used biosensensors.
Unable to gather all the patient's body parameters.
Based on the Internet of Things (IoT) and fog computing, this study offers an e-health system for monitoring geriatric health. [24] To enhance the privacy and security of healthcare data and reduce the communication latency of the patient monitoring system.

Edge
computing, cloud computing, firewall, WSN, data management system, service alert It was a proposed system; no implementation was shown, and the used cryptographic algorithms were not evaluated.
Blockchain and cryptographic algorithms is used to provide more security and provacy on medical data. Edge computing is also used to reduce communication latency. [27] To develop a secured framework using fog computing, IoT, machine learning, and blockchain to provide a better experience in healthcare.

Raspberry Pi 3, Naive Bayes
Classifier, sensor to measure patient's body parameters like oxygen saturation, blood pressure, body temperature and heart rate.
It assumes that each patient is only treated by one doctor, which may not be the situation in practice.
Though they did not develop or implement anything but presented a well-described, step-by-step methodology. [28] Authors employ rigorous simulations to evaluate MeDIC in four use scenarios, demonstrating that it not only minimizes uplink traffic but also enhances response time, which is crucial in real-time medical applications. Furthermore, decision-making based on real-time healthcare data increases the system's utility. [30] In a word, this research will add or complement existing cancer treatment options or methods used for cancer prevention, reduction, detection, As they work with many sorts of sensitive data, they should be concerned about data security.
The goal of the study is to create a smart, integrated IoT healthcare system for cancer treatment. [31] To improve the operational system of ICU monitoring at one of Jakarta's private hospitals by implementing IoT with the Business Process Reengineering (BPR) approach. [32] To discuss on various types of IoTbased intelligent healthcare monitoring systems with their advantages and disadvantages and also mention their common design and implementation patterns.
--They showed a comparison between different smart healthcare monitoring systems with their advantages and disadvantages. In addition, they mentioned opportunities to improve the systems they discussed. [33] Smart patient monitoring systems provide precise, transparent data on plant processes, such as energy use. It also collects, processes, and consolidates data and analytics, simplifying record-keeping and reporting processes and integrating all decision-making processes, resulting in improved medical care and lower costs.

WLAN,
WWAN, M5 NanoStation, WiMAX, ZigBee, WPANs (LR-WPANs), Bluetooth low energy (BLE) -The construction of a new unifying architecture for many wireless technologies is the work's key contribution. They We've also set up a decision-making tool to store and evaluate the data they've gathered. For the unique patient surveillance system, a logical architecture as well as a physical architecture is described.

III. METHODOLOGY
The section is classified into three interconnected sections. Firstly, this section presents the mechanism of settings and monitoring the devices. Secondly, data collection and data manipulation will be discussed. Finally, this section offers the mechanism of real-time data monitoring.

FIGURE 1. Overview of our proposed system
As we know, ICU patients need all-time monitoring because any time the patients' health conditions can be critical, even they can die. Our IoT based smart ICU system will be a solution for the ICU patients as our proposed system will be real-time monitor these critical patients of ICU by taking parameters (such as temperature, Blood Pressure, ECG, SpO2, fluid measurements (blood circulation, glucose, lactate, calcium, potassium)) from patients' body through the IoT devices. Further, the collected data will be stored in Fog nodes, where the data will be processed and sent the reports to the cloud to store. Also, after real-time data processing, if there are any abnormal parameters, our system will notify the assigned doctor(s) and ECU for further treatment of that patient. Figure 1 represents the overview of our proposed systems.  In figure 2, the workflow of our proposed model is shown. In step 1, we will set up our monitoring device in the hospital's ECU section. Also, we will set up our IoT device in the patient body to take the real-time measurement of body parameters. In the next step, our proposed device will collect all the parameters data and send it to the fog node to further process that data. The fog node will generate a report after processing the collected information, and it will send that report to the cloud for storing. In the last step, doctors can remotely monitor their ICU patient's messages at anytime and anywhere from the cloud in our proposed model. Additionally, our system will send a notification to the assigned doctor and ECU if the body parameters of any ICU patients pass the critical levels of the standard body parameters. Additionally, figure 3 depicts the planned architecture, which is made up of three layers. The first layer collects the patient's body parameters using sensors to assess the patient's state. The fog nodes in the second layer of the architecture process all the data collected in the first layer. Our system's data latency will be reduced thanks to the fog nodes. As we know, obtaining data from the cloud takes substantially longer than collecting it from the network edge; therefore, performing these actions close to or at the end-users would reduce latency; therefore, we implemented fog nodes in our proposed system [21]. The final layer includes a cloud-connected to the fog via a proxy server and is responsible for storing data for longer periods. Our system will be connected to the internet via a proxy server, which will encrypt data before transferring it to the cloud storage. The proxy server can also act as web filters and firewalls, enhancing our system's security and preventing hackers [35], [36].
Data Collecting, Processing & Storing (DCPS), and 3.3. Real-Time Data Monitoring and Notifying (RTDMN). In the below section, we will be described about these modules.

A. Setting and Checking Monitoring Devices (SCMD)
In this section, we will establish our monitoring device in the hospital's ECU section so that caregivers of the hospital can always monitor the patient's body temperature, blood pressure, ECG, SpO2 & fluids. To measure these parameters, we will set up our IoT device in the patient body to take the real-time data of body parameters. After measuring the body parameters, the SCMD module will go to the next module, DCPS. Our system will collect all the body parameters data for processing and then store it in the cloud. To understand this step clearly, a flow chart is given in figure 4. Figure 05 represents the flow chart of the data collection, processing & storing unit. After collecting all the body parameters data, our proposed system will send it in the fog node for further processing. The fog nodes were used to monitor patient conditions in real-time by analyzing data obtained from multiple sensors connected to a patient body.

B. Data Collecting, Processing & Storing (DCPS)
But if doctors need to checkup a patient's health record, they have to view or get it through a web app. The web app will fetch data from the cloud database and generate reports on user demands. For further use, the report can be saved as a document file, e.g., a PDF, or also it can be printed directly from the web app. Only the authorized personnel will be allowed to log in there to access these kinds of data. Moreover, we used MongoDB Atlas in our system to store patient data in the cloud. If we need to generate a patient health record, then it is possible to generate it within a short time by fetching data from the database. In the first step in algorithm 1, our system will initialize the sensors, fog nodes, proxy server, cloud. Then our system will collect all the parameters values through the sensors and send them to the fog nodes to process the data to determine the patient's state. After processing, fog nodes will send all the data to the cloud through the proxy server for storing the data.  Input: N number of health attributes values from sensors, Prefixed threshold values of the attributes. 12 Step 1: Determine health attributes for the current timestamp and compare them to the threshold value in fog node 13 Step 2: for i = 1 to N 14 Step 2.1: if ((Attribute_Value(i) > Threshold Value(i)) OR (Attribute_Value(i) < Threshold Value(i))) 15 Step 2.1.1: Then Patient_State = Unsafe 16 Step 2.2: else Patient_State = Safe 17 Step 2.3: return Patient_State 18 Step 3: Send patient state and health attribute data to the proxy server 19 Step 4: Send patient state and health attribute data from the proxy server to the cloud 20 Step 5: Generate reports of patient health attribute data in the interval of every half hour. 21 Output: Current State of the patient

C. Real-Time Data Monitoring and Notifying (RTDMN)
For remotely monitoring ICU patients' conditions, assigned doctors can see their reports anytime and anywhere from the cloud storage throughout our proposed model. If the assigned doctor is in the hospital, they don't need to access the cloud storage because the fog nodes also have the report, and the doctors can easily access the report from fog nodes. If the ICU patients' body parameters level exceeded the critical limit, our system would send a notification to the assigned doctor and ECU. A beep will sound in the ECU to alert the staff of the patient's condition. Our system will produce a buzzer sound in 30 seconds if normal for the patient's body parameters. Suppose any of the patient's body parameters drop or increase. In that case, our system will alert the ECU with a buzzer sound in 5 seconds, and it will play this sound for a set amount of time to determine whether the patient's condition is normal or not. Suppose the patient's condition does not improve after the specified time. In that case, our system will continuously emit a buzzer in the ECU for 0.5 seconds and send a notification message to the appointed doctor via GSM. If there is no response from the assigned doctor after getting the notification from our proposed model, then the ECU will manually call the doctor and ready all the treatments for the patient. Whereas if the assigned doctor is not in the hospital, the ECU will manually call the duty doctor to treat the patient. Figure 6 represents the flow chat of real-time data monitoring and notifying steps. The first stage in algorithm 2 is to assess the patient's condition. If the patient's condition is irregular, the system will keep the ECU's buzzer on until a certain time has passed. If the patient's condition does not improve after the specified time, the ECU and the assigned doctor will be notified. Step 1: Call algorithm 1 to determine patient's health state 2 Step 2: if (Patient_State NOT Safe) 3 Step 2.1: if the unsafe state doesn't exceed a specific period 4 Step 2.1.1: Keep the continues beep sound ON in the ECU 5 Step 2.2: else if the unsafe state exceeds a specific period 6 Step 2.2.1: Send emergency notification to the ECU and doctors 7 Step 3: else go to step 1

IV. RESULTS
In this section, we will discuss the results of our proposed system. Firstly, the section interprets the fog computing-based data analysis. After that, the sensor data analysis is discussed, including the pulse oximeter for saturation level and digital thermometer for health temperature analysis.

A. FOG COMPUTING-BASED DATA ANALYSIS
In this study, we used the emulator Mininet-Wifi. To run this, we used a PC having the following configuration mentioned in Table 2. Also, Figure 7 shows the CPU utilization in response to time while dealing with the fog data analysis. The figure clearly shows the fluctuating level of CPU utilization while accessing the data through the fog. The result of CPU Utilization During Emulation is given to Table 3.   To remove DC, we need the value of α as rather close to 1. So here we are using α = 0.95.
After removing DC signal, we applied mean median and Butterworth filter, and used the following equation to measure the heartbeat rate in BPM (beat per minute).
Here, 60,000 is the number of milliseconds (1 minute). We used the Arduino's millis() function to track the timestamp of every beat.
To calculate the SpO2, we used the following standard formula: Here, R is the ratio of two wavelengths: IR (950nm) and RED (650nm) used in the sensor to measure SpO2. This can be written as: Or it can also be written as like this: Where, IAC = light intensity (where AC presents), λ1 = 650nm of RED and λ2 is for 950nm of IR light wavelength.
A patient's heartbeat and SpO2 can be measured using our proposed approach. For any human being, a typical heartbeat rate is 60-100, and a normal SpO2 rate is above 95. If the heartbeat and SpO2 fall below or rise beyond the usual rate simultaneously, our system will quickly notify the ECU and the doctor and emit a buzzer sound in the ICU every 0.5 seconds. Furthermore, the system will emit a buzzer sound in the ICU every 5 seconds when the patient's heartbeat or SpO2 drops or rises. Some experimental data of heartbeat and SpO2 is given in Table 4.

C. DIGITAL THERMOMETER (MAX30205) DATA ANALYSIS
We used a digital thermometer sensor to measure the patient's body temperature. Using the following equation, we calculated body temperature from the sensor value.
Temperature = Sensor_raw_data × 0.00390625 (5) Using this formula (x3), we get the temperature in the Celsius scale by default. To convert it in the Fahrenheit scale, the following equation is used: Temperature in °F = (Temperature in °C × 1.8) + 32 (7) Our system can also measure the patient's body temperature, which is 36.5-37.5 °C. If the body temperature increases or decreases, then the system will notify the doctor and ECU, and body temperature experimental data is given to Table 5.

D. SENSOR ORIENTATION OF THE MODEL
In this section, the sensor orientation of our model is shown. The two sensors, MAX30205 and MAX30100, are connected to an ESP32 SoC's I2C bus. ESP32 continuously receives data from all connected sensors, then primarily processes the sensor data and converts it to our known unit. After initial processing, body parameter data is sent to the fog node via Wi-Fi for further analysis and report generation, VOLUME XX, 2017 9 As shown in Figure 8.

V. DISCUSSION
After carefully reviewing all the literature, it has been discovered that a massive work has been carried out on smart IoT devices for ICU patient monitoring systems. In short, [14,15,20,30] papers presented an IoT application that estimate SpO2, blood pressure, temperature, ECG a, and the paper [19] presented an IoT application that measure metabolite concentrations in patients. However, some of these papers can only measure the SpO2, heartbeat, blood pressure, temperature, ECG from patients' body and the others one can measure glucose & lactate from patient's fluids. In sharp contrast, our proposed system can measure both parameters (temperature, SpO2, heartbeat, blood pressure, ECG, and also can measure glucose, lactate, blood circulation, red blood cells, white blood cells, calcium, potassium from the patient fluids) which is a unique contribution to the ICU monitoring system of a patient because so far, no paper has measured all the parameters at the same time. The author of the paper [18] used battery powered IoT devices to monitor the ICU patients where they need to frequently recharge or change the batteries, resulting in system downtimes and increased operational costs. On the other hand, our proposed smart IoT ICU monitoring system will have wired and wireless facilities. The paper [34], described the modern health care system known as Smart ICU or EICU, where the author used the cloud to store the collected data. On the contrary, our system has utilized fog nodes which are connected to the IoT sensors to store the collected data because it works with real-time sensor data and reduces latency while data fetches and it enables faster data access than cloud. A very few papers applied fog node technique in their methodologies. So, here our system will play a significant role in the ICU monitoring system. Additionally, the fog nodes will be connected to the internet through a proxy server and, we used a firewall on this server to protect data from hacking. To ensure data security, the proxy server will encrypt the data before sending them to the cloud for storing the data and generating future reports of a patient. As our system's fog nodes are not directly connected to the internet, it will ensure better security by reducing the chances of data hacking Also, from the simulated data, it is clearly observed that the sensor's data plays a significant contribution to the automation of ICU and EICU. The data analysis of the pulse oximeter and digital thermometer indicates that our system can be workable in real-life scenarios as the system can measure the SpO2, heartbeat and temperature parameters state of patients' as shown in table 3 & 4, where the system can measure normal, warning & critical state of the SpO2, heartbeat and temperature parameters. On the other hand, the fog computing-based scheme is a unique concept for dealing with IoT-based cloud data. In our proposed system, fog nodes allow end-user devices to cooperate on tasks like processing, storage, and network communication. Because it's obvious that receiving data from the cloud takes significantly longer than collecting it from the network edge, doing these actions close to or at the end-users will reduce latency [21].

VI. CONCLUSION
This study proposes a smart IoT-based system for monitoring ICU patients, which will tremendously reduce the risk of human mistakes when a patient is in 24/7 continuous monitoring. Our system is capable of monitoring a patient's several numbers of vital signs (such as temperature, SpO2, heartbeat, blood pressure, and ECG), along with the measurement of glucose, lactate, blood circulation, red blood cells, white blood cells, calcium, and potassium in the patient's fluids. It will alert the doctor and ECU personnel if any abnormalities are noticed. Fog nodes were utilized to store and process patients' data. Moreover, the nodes generate reports based on various health parameters data of a patient, which is further stored in the cloud. Besides, doctors and ECU personnel can real-time monitor ICU patients and view their reports from anywhere, anytime. We plan to increase data security and implement machine learning techniques into our current proposed work as future scope of improvement. Also, we will try to detect any blood clots in the ICU patients' veins and specific diseases related to them. To accomplish the proposed model's objectives, a set of experimental data has been enumerated and interpreted. However, the proposed system can be workable in real-time patients monitoring and proper automation of the cloud-based ICU.