Fuzzy Logic-Based Health Monitoring System for COVID’19 Patients

: In several countries, the ageing population contour focuses on high healthcare costs and overloaded health care environments. Pervasive health care monitoring system can be a potential alternative, especially in the COVID-19 pandemic situation to help mitigate such problems by encouraging healthcare to transition from hospital-centred services to self-care, mobile care and home care. In this aspect, we propose a pervasive system to monitor the COVID’19 patient’s conditions within the hospital and outside by monitoring their medical and psychological situation. It facilitates better healthcare assistance, especially for COVID’19 patients and quarantined people. It identifies the patient’s medical and psychological condition based on the current context and activities using a fuzzy context-aware reasoning engine based model. Fuzzy reasoning engine makes decisions using linguistic rules based on inference mechanisms that support the patient condition identification. Linguistics rules are framed based on the fuzzy set attributes belong to different context types. The fuzzy semantic rules are used to identify the relationship among the attributes, and the reasoning engine is used to ensure precise real-time context interpretation and current evaluation of the situation. Outcomes are measured using a fuzzy logic-based context reasoning system under simulation. The results indicate the usefulness of monitoring the COVID’19 patients based on the current context.


Introduction
COVID'19 positive older adults with some medical history (comorbidity) have more probability of suffering from long-term illness or certain severe or life-threatening medical conditions. They might get terri ed as soon they came to know about their likelihood of being COVID '19 positive. The psychological pressure on these age groups makes them scared, feeling stressed, and depressed. The fear of social isolation and feeling of loneliness may increase their mental stress. Context-aware computing can be an effective solution in such a scenario as it has demonstrated success in many domains [1][2][3], thanks to its accuracy. The proposed approach is designed for facilitating remote monitoring services to improve the quality of care of COVID'19 patients. A context-aware system for monitoring a patient's medical and physical conditions receives information. It consists of combinations of sensors to gather the patient's physiological signals to predict the patients' current condition through a decision support system and initiate necessary actions to safeguard the patient's life. The proposed pervasive context-aware architecture to monitor the patient's condition uses a fuzzy logic-based context-modelling and reasoning framework. As shown in Fig. 1, the system consists of the following modules.
a. Wireless Sensor Network (WSN)-Consists of sensors for monitoring the patient's vital signs. b. Remote monitoring services: For monitoring the patient's physiological signal remotely and continuously through Body Area Network (BAN), connected to the internet and facilitating the interaction between patients and caretakers through a web camera and sensors. c. Reasoning and decision support: To predict the patient's current situation through current and previous knowledge and to perform an action accordingly. d. Cloud Storage: To store sensor data for future analysis services.
It is challenging to obtain a correct and accurate prediction of the current context using the traditional approaches, especially with the raw data. i.e., the sensor data, which might be imperfect and incomplete. This research aims to develop an extensible and exible approach to monitor the patient's vital signs based on the current context and predict the patient's condition even remotely and act accordingly. The current context is interpreted using a fuzzy reasoning framework, which facilitates meaningful reasoning. The framework and its performance are evaluated using simulation.

Literature Survey
References [4,5] describe the basic concepts of remote patient monitoring while [1,6,7] investigate related issues such as health conditions' monitoring on speci c aspects, scheduling alarm in the particular situation, and behavioural activities of the patient. Reference [8] reviews the personal care prototype of wearable devices, like Jawbone UP. Reference [1] illustrates (a) monitoring patients' activities for an extended period, (b) pattern recognition during sleeping, and (c) automatic warning indication. CARA project [7] develops the context-aware decision processing in a hospital environment and [9,10] propose a framework to facilitate optimized and continuous care using intelligent reasoning methods for the massive volume of heterogeneous data. The cascaded reasoning method [2,11] designed a pipeline for reasoning components to monitor patients. References [12,13] created a context-based emergency alarm system for doctors to monitor their patients' health. References [14][15][16][17] proposed a prototypal model for operatorassisted home-based total care networks integrated with a service platform to share patient-related information. Reference [16] advised a patient's electrocardiogram (ECG) monitoring collecting and displaying the ECG data in real-time. References [18][19][20][21][22] have suggested various methods for monitoring the patient's medical condition. Psychological parameters play a vital role in a patient's recovery. The positive mental health will make the patient feel better and improve his/her health. References [23,24] proposed sensor-based activity recognition in smart homes. The researchers in [25][26][27][28][29][30][31][32][33][34] proposed an approach to characterize the patient's length of stay in the hospital relating to its context and traits. In this paper, we propose a framework to monitor the patient's medical history and psychological factors, especially for the COVID'19 affected older adults.

Proposed Methodology
WSN plays a vital role in implementing the proposed healthcare monitoring system, as shown in Fig. 1. According to the design, the patient is monitored by WSN. Once the WSN starts collecting the data, the gathered information is sent to the BS (base station) for further processing. WSN and BS are connected through WiFi, ZigBee [35] or Bluetooth. The data processing layer processes and analyzes the data. Caretakers, hospitals, or healthcare professionals are provided with the interpretation obtained through the data processing and decision analysis based on the physical event monitoring, the patient's medical history, and its comparison with the current context. The reasoning method is used to understand the patient's behaviour based on the current context. Among the various context reasoning decision models available, the fuzzy logic is selected as it makes it easy to add, delete, and update the rules based on the context. Semantics-based ontology mechanisms, rule-based expert systems, statistical classi cation, and instance-based are examples of existing reasoning mechanisms. However, these approaches need domain knowledge to fabricate better output. Though the Neural Network (NN) and Bayesian NN (BNN) can understand the problem, the system must be trained frequently to update the model weights. It is proposed to develop a new framework to overcome the frequent update of model weights in the existing system. The new framework is designed by adapting the rule-based method with learning skills, making our system more intelligent than the current system. We propose the most suitable approach to obtain pervasive healthcare monitoring by combining a fuzzy rule-based reasoning method, a classi cation model, and a case-based reasoning method into a single framework. This proposed framework will recognize the patient's condition based on daily living activities and their medical history. In the proposed approach, a context-aware healthcare monitoring system is implemented using a window-based framework (Fig. 2). In Fig. 2, "Patient," "Department," "Doctor" and "BAN" (Body Area Network-a wireless network of wearable computing devices) are members of the framework. The sensing operation is carried out based on the time or context. As the interpretation of the sensor data as the context is imperfect and incomplete, to make the sensor data meaningful, an extensible and exible method is adopted by implementing the processing and decision-making approach. The working principle of the window-based framework for the hospital management system is shown in Fig. 3. It comprises the following steps where P n denotes the 'nth' patient, DP n denotes the 'nth' department, D n denotes the 'nth' doctor, and H n denotes the 'nth' hospital.
Step 2: Sensing and Processing Step 2.1: P k dp (w) and BAN dk p (w) be the amount of data generated from the patient's P p respective BAN p in the kth hospital's dth department.
Step 2.2: Processing of the sensor data using Fuzzy Context Model After initializing all the requirements and components wherever it is essential to monitor the patient's health condition, the next step is to process the sensor data. Moreover, sensors' data need to be indexed as context entities' attributes to perform this operation. A fuzzy context model is used to structure the context of current raw data and constructed with two models, namely the low-level context and high-level context models. The low-level contexts are structured into Personal Context and Environmental Context. In contrast, the high-level contexts consist of the activity event and medical condition. The patient's state is obtained from the low-level context and high-level context that identify the patient's current condition based on the current context. The different types of attributes belong to low-level and high-level contexts are listed in Fig. 4.
After pre-processing, the sensor data is indexed into the respective attributes set using a discrete fuzzy set. The fuzzy set is adapted to represent sensor data attributes as a low-level or high-level context using the fuzzy rule-based engine. The respective membership function for each attribute is built with the fuzzy set ( Fig. 5). The function is used to represent how each attribute is taking part in the activity. It is used to measure the degree of involvement of each input. A membership function symbolizes the degree of participation of each input. It describes the functional overlap between inputs and eventually agrees on the output response. The attributes and their corresponding membership functions for our context model are given in Tab. 1 Along with the high-level context elucidation, the reasoning operation is also performed with the help of the fuzzy set listed in Tab. 1. In the fuzzy reasoning process, the relationship among the attributes is identi ed using the fuzzy semantic rules. These Semantic rules are also used to map the various fuzzy sets. The syntax for the fuzzy semantic rules is de ned as follows.
"If A is X, then B is Y," where A and B are the fuzzy numbers in the fuzzy sets X and Y.
The membership values (weighting factors) are used to nd the supremacy of semantic rules in the fuzzy output sets. Inputs are combined logically (based on logical methods) to obtain a speci ed input's expected output. For example, consider fuzzy semantic rules given in Tab. 2.    If (Activity is Resting or Activity is WatchingTV) and Duration is VeryLong, then the Situation is Abnormal Rule 3 portrays that though the location is the kitchen, the cooker is in the off state. By this condition, fuzzy reasoning mechanism will predict that the situation is abnormal, and hence the patient is in an abnormal condition. Psychologically, COVID'19 patients are disturbed due to the current pandemic and lockdown. We can predict the COVID'19 patients' condition based on current context and activity. These activity-based semantic rules will produce a better outcome. For instance, Rule 2 combines the fuzzy set location and the context to formulate the semantic rule. Though the patient is not in Bedroom, the patient is sleeping. It says that the patient is Abnormal, and the patient needs medical assistance immediately. By monitoring the activity of COVID'19 affected patients, it is possible to predict their psychological and medical conditions. Tab. 3 lists the examples for Fuzzy Patients' medical history-based semantic rules. Here a patient's medical history and activity event are considered to predict the condition of the patient. In rule 2, fuzzy sets such as location, TV, and patient's medical history predict the patient's status. Usually, the sensor data is uncertain, inaccurate, and consists of missing information. Due to this distinctiveness and to make the sensor data meaningful, a rule-based mechanism is proposed by adopting the fuzzy logic principle.
As shown in Fig. 6, this rule-based system consists of fuzzy sets, rules, and a hypothesizing engine to predict the sensed data based on the current context. From the inference operation, the patients' current status is decided. The fuzzi cation uses the de ned membership functions to process the inputs like ECG (Electrocardiogram), BP (Blood Pressure), Temperature, etc., and fuzzify them. The inference/hypothesizing engine begins the processing after fuzzifying the input with the membership function's help. It uses the de ned semantic rule to classify the input from one or more fuzzy sets to map with the patient's correct condition.  After mapping, the defuzzi cation is performed to extract the fuzzy output, obtaining the patient's exact status. Decisions should be made by applying effective data analysis techniques. Assume that a patient's blood pressure data A checked on timeframe T = {1, 2, 3, . . . , t} with G = {W1, W2, . . . , Wm} window frames as shown in Fig. 7. For example, P 23 4 represents the patient '4' associated with the department '3' in hospital '2'. B 32 34 indicates BAN-3 of patient 4 is tied to the department '3' of hospital '2'. The normal blood pressure of three-timeslots (4, 5, 6) in the second (Fig. 7) window (W2) is checked as 140 (Avg.W2), which is higher than the critical level of 125, i.e., (if (Avg.Wm > 125)).

Step 3: Storage and Access
After extracting and processing the sensor data to decide the patient's condition, it must be stored for further analysis. For this purpose, cloud assistive technology [36] will bring a better outcome. Assume that there is a geo-dispersed data center DC n , where {n = 1, 2, 3, . . . , N} placed in the cloud, connected to all gateways GW m where {m = 1, 2, 3, . . . , M}. With gateways' help, the data is transferred and stored in the corresponding cloud data center for future analysis.

Performance Evaluations
Monitoring and measuring Covid'19 patients' daily living activities are mandatory to decide their medical history and psychological condition. It is essential to monitor the daily living activity of Covid'19 positive patient is to recognize their psychological condition. This daily living activity can be classi ed, based on the motion, into (1) the motionless activity or static activity, and (2) motion full or dynamic activity or complex activity. The static activity corresponds to the motion which belongs to the human body's static posture, such as lying, standing, sleeping, etc., measured as the thigh and trunk posture. Three-dimensional acceleration and orientation of the thigh and the trunk (t, Ax, Ay, Az, Gx, Gz, Tx, Ty, Tz) are measured continuously using smartphones and bio harness sensors. The standard deviation in each one-second window of the thigh or trunk acceleration values determines the motionless activity. When the standard deviation is lower than a threshold, then the activity is classi ed as static else dynamic. In our testing, the threshold value for thigh acceleration was 0.25 m/s, and for the trunk, it was 0.3 m/s to detect static activity. The patient's activity state is determined by accelerating the thigh and trunk and previous activity state. If the acceleration value is above the threshold and the previous state is static, then the patient activity transits from static to dynamic. The algorithm in Fig. 8 is a simple rule-based system used for the real-time recognition of static activities. The mean accelerations over the one-second window are converted to a corresponding inclination angle (α), using the arc cosine transformation, as described in Eq. (1).
where β is the mean acceleration of the corresponding axis, f is the earth's gravity, α in degrees corresponds to the angle of inclination for the trunk or thigh. Moreover, the real-time classication of complex/dynamic activities of Covid'19 patients, the machine learning classi ers, such as Bayesian Network, Decision Tree, K-Nearest Neighbors, and Neural Network, are employed. For new occurrences, the classi cation model is used to identify the membership. The inference process starts as soon the classi cation model is fed with the sensor data and completes with the help of the features extracted from the sensor data. The patient's activity is predicted from the maximum con dence value.

Classi cation Models
Information was obtained from individual patients named physically for supervised learning. Each person's data are randomly grouped for training and testing. The classi cation model is applied to each record's training data set and then tested with the respective testing set known as the personal model. This model is speci c for each user but cannot be adapted for different users. Moreover, to overcome the scalability limitation in a personal model, another model is proposed, as the default model can be adapted for different users. In this model, the diverse user's information is joined together to fabricate a standard classi cation model. Though a common classi cation model is built, it may not match each person's speci c activity because of the individuals' physical divergence. Further, to obtain better performance using the classi cation model adapted model, misclassi ed occurrences are removed or ltered after evaluating the default model using a 10-fold cross-validation method.
As shown in Tab. 4, the default model's and adapted model's total instances are 6109 and 6827, respectively. The adapted model can be the perfect model for each user as it can be built with higher instances. The 10-fold cross-validation is used to test the classi ers' ef ciency because the adapted model is examined for each speci c user by applying various machine learning classi ers. Tab. 5 lists the performance of different classi ers. Each adapted model's classi cation accuracy remains consistently above 90%. Fig. 9 plots three different Bayesian network classi er models' accuracy values for eight patients. The default model's process starts with identifying the most related/similar previous cases (or problems). Their information is then reused to solve the problem (similar to a previous case or problem). Next, this solution is modi ed for the new problem. The updated solution is retained if it is suitable for solving the new problem.   The similarity measures involved in case-retrieval very much depend on the application domain. Further, context awareness and a query-sensitive mechanism are used for the similarity measure to address these problems. The query-sensitive methodology is developed with context understanding within our reasoning system, as in Eq. (2).
where Qi represents the global similarity of the present case (queried) P. The past case T · Q i is calculated based on the local similarity of the present case, the past case, and the dynamic weight E. The default model (CBR) is capable of making analogies based on previous experience. However, to perform reasoning functions, suf cient solved cases are needed as the reasoning resources. Supervised learning scheme-labelling the solutions can be tedious. Unsupervised learning mechanism-by adopting an adaptation technique for CBR derived from fuzzy logic based on intelligent reasoning and modelling.
• The Fuzzy adaptation model rst con gures the fuzzy reasoning engine by setting up fuzzy sets and rules.
• Then traverse the case base to nd similar cases using K-NN. Now, based on the traversed case, predict the weighted median of similarity.
• If the con dence of the prediction is low, apply the fuzzy adaptation technique.
• Use the fuzzy output to revise the solution of the present case. Daily activity performance can be measured with the help of a confusion matrix as shown in Tab. 6 • If the outcome of a prediction is abnormal, and the actual situation is also abnormal, it is called a true positive (TP).
• If the actual situation is normal, but the predicted situation is abnormal, it is a false positive (FP).
• Conversely, a true negative (TN) has occurred when both the prediction and actual situations are normal. A false-negative (FN) is when the prediction outcome is normal, while the actual situation is abnormal.
The receiver operating characteristic (ROC) is used to evaluate our reasoning framework to predict accuracy. Fig. 10 describes the ROC curve calculating the TP and the FP rates. Each point in ROC represents the prediction result for three different models. The best possible prediction method would yield a point in the upper left corner (0, 1).  For the Fuzzy adaptation method, the best performance is 96.5% Speci city, 92.3% Precision, and 91.8% accuracy (Fig. 11); while setting the con dence value threshold to 0.7, the normal CBR approach only gives 91.5% Speci city, 82.8% Precision, and 89.5% Accuracy.
The proposed method's packet loss and data transmission rates are compared with the existing healthcare monitoring system [18]. Tab. 7 describes the amount of data transmitted within 24 hours, the packet loss rate, and the sensor data acquisition frequency. As in Tab. 7, while using the existing method, the percentage of packet loss is 0.7% for transferring 7MB of data per day.
For the Fuzzy adaptation method, the best performance is 96.5% Speci city, 92.3% Precision, and 91.8% accuracy (see Fig. 11); while setting the con dence value threshold to 0.7, the normal CBR approach only gives 91.5% Speci city, 82.8% Precision, and 89.5% Accuracy. The proposed method's packet loss and data transmission rates are compared with the existing healthcare monitoring system [17]. Tab. 7 describes the amount of data transmitted within 24 h, the packet loss rate, and the sensor data acquisition frequency. As in Tab. 7, while using the existing method, the percentage of packet loss is 0.7% for transferring 7MB of data per day. In our proposed method, the data loss of transferring 30 GB data per day is less than 0.64%, as shown in Tab. 8. Therefore, the proposed method (in Tab. 8) has a better packet delivery ratio than the existing method (in Tab. 7). From Tab. 8, the short-distance wireless transmission and remote wireless transmission are operated normally, and there is less data loss while transmitting the health care data in real-time.

Conclusion
In this article, we proposed a context-aware health monitoring system to monitor the health and psychological condition of the COVID'19 affected or quarantined elderly patients. This framework is developed with a fuzzy-reasoning mechanism to make a prediction/decision about the patient's status using the event and medical context. A fuzzy context set is used to categorize the attributes based on the activity of the patient. The patient's activity and medical history are recognized using three different classi cation models; among these fuzzy adapted model yields the best accuracy since it follows the unsupervised learning method. This proposed method appreciably improves the reasoning engine's performance in accuracy, speci city, and ef ciency. By adopting the proposed framework, the COIVD'19 patients, especially the older adults, can be monitored to analyze their activity based on the context. Moreover, this is obtained by acclimatizing the adaptation model with the context reasoning method. The proposed method can enhance the system functionality in security aspects since the patient's data carries the most accurate information to undergo treatment encryption standards.
Funding Statement: This work is partially funding by the University of Malta's Internal Research Grants.

Con icts of Interest:
The authors declare that they have no con icts of interest to report regarding the present study.