Mobile-based Activity Monitoring System for the Self- quarantine Patient

Nowadays, not all the patient can be hospitalized because of the COVID-19 pandemics. So, the self-quarantine for the patient with the various diseases will be the given solution by the hospital. It would make the hospital needs a system that can monitor the activity and the position of the patient from a distance. Nowadays, mobile phone is equipped by the sensor that can detect the user movement. Not only the user’s position, but also the user’s activity. In this paper, it will be developed an activity and position monitoring system for the self-quarantine patient that can be used in their home. The mobile activity monitoring can be achieved by activity recognition using classification method. For the needs of performance testing, we evaluate some classification method for activity recognition to compare the among classification method for the activity recognition. Some tested classification methods are Naïve Bayes, KNN, KStar and TreeJ48. Furthermore, we tested the impact of sliding windows per N samples taken to the accuracy of the activity recognition. We choose the best N sample that could give the best accuracy for activity recognition. The system not only monitor the patient’s activity, but also the patient’s position. The position monitoring can be achieved using Google Maps API. The result is Naive bayes has the accuracy of 81.25%, KNN has the accuracy of 78.125%, KStar has the accuracy of 78.125% and TreeJ48 has the accuracy of 75%. The N sample that could give the best accuracy is 6 with the accuracy of 90.15%.


INTRODUCTION
Nowadays, Covid-19 Pandemics has been spread out of the world. In some regions, the hospitals are full of the covid-19 patients and the hospitals have the limited capacity to the hospitalized patients. Because of 1* Corresponding author that situation, the hospital would be more selective for the covid-19 hospitalized patients based on their emergencies. If the covid-19 patient has the high emergency, then the patient will be hospitalized. But, if the covid-19 patient has the low emergency, then the patient will not be hospitalized, and the hospital will advise the patient to be the self-quarantine patient in their home. Although the low-emergency patient is not hospitalized, the patient has to be monitored by the hospital in a distance.
Patient's activity monitoring in a distance is not only for the hospital, but also for the patient's family. Based on the research [1], the Covid-19 virus spread out rapidly by contacting with the infected people's droplets. When the healthy people contact with the infected people, it will increase the risk of Covid-19 spreading. For minimizing the contact to the Covid-19 patient, it needs to develop the patient's activity monitoring system in a distance.
Y. Liu, et al [2] explain that the activity recognition can be retrieved from the sensor-based. The one of the sensors that can be used is accelerometer. The other research study [3] also explain the sensor-based activity recognition that focus on the low cost, low power that is appropriate to the mobile environment.
There is a pre-processing of the retrieved raw data accelerometer before classification process for the feature extraction and classification purpose. To get the detailed activity from the raw data, it segments the raw data into a fixed window as shown as the research studies [4]- [6]. The sliding windows is widely used because of its simplicity.
The system gets the raw data of the patient's activity from sensor-based activity. The segmented raw data will be aggregated and sent as the input of classification. Some research purpose the several kinds of classification method for the activity recognition. In study research [7], Naïve Bayes gives the best accuracy of the human activity recognition in their experimental results. In other study Researches [8], [9], [10] the human activity recognition is obtained K-Nearest Neighbor (KNN) classification method. Not only Naïve Bayes and KNN, but also KStar is considered as the used classification method for the human activity Recognition [10]. The other study research [11] also uses the different method called Decision Tree J48 and give the best accuracy in their experimental result of classification method in activity recognition.
The study research above explains how the different classification method delivers the different experimental result in terms of the accuracy. The other study research [12], [13] explain the impacts of the window size in window sampling to the accuracy of classification method in activity recognition.
In this research, we proposed the self-quarantine Covid-19 patient monitoring system by monitoring the patient's activity in a distance to prevent contacting with the infected people. From the patient's activity we know the predicted condition of the patient in a real time, it is in an emergency condition or normal condition by discovering/perceiving the self-quarantine patient's activity. The emergency condition is such there is an abnormal change, like passed out/fainted, from standing to laying. As the normal condition, like sleeping, the normal change is from the standing-sitting-laying.
This system monitors five kinds of patient's activity, they are LAYING, SITTING, STANDING, WALKING, or RUNNING. This research uses the sliding windows-based feature extraction to perceive the detailed raw data of each patient's activity and the classification method to determine the patient's activity. From the mentioned study research above, there are some classification methods that are evaluated to inform the accuracy of each method in classifying the patient's activity. In this research, it will be examined Naïve Bayes, K-NN, KStar and Decision Tree J48 as a comparison of the classification method accuracy. Furthermore, in this research will be evaluated the optimum N samples taken in sliding windowbased feature extraction with the highest accuracy to classify the patient's activity in a real time. The main section of this paper includes Introduction, Related Works, Methods, Results and Discussions, and Conclusion.

II. METHODS
The purpose of the patient monitoring system is to prevent contacting the Covid-19 patient but still monitoring the patient at a distance. We could still know the patient's activity although we are at a distance from the patient. To specify the patient's activity, the system will retrieve the raw accelerometer data from the accelerometer sensor in the patient's mobile device. The retrieved raw accelerometer data represents the whole patient's activity. So, the system needs to retrieve the detailed activity changes of the patient by retrieving the detailed raw data for each activity. Following the procedure, get the raw data of the whole patient's activity, then the system will get the exact data of each patient's activity using sliding windowbased feature extraction. The sliding window-based feature extraction [5], [12] will obtain the detailed raw accelerometer data to be classified by the classification method. The outcome of the classification is the patient's activity (LAYING, SITTING, STANDING, WALKING, or RUNNING). In this research, it will be implemented the several kinds of different classification methods. they are, Naïve Bayes, K-Nearest Neighbor (K-NN), KStar, and Decision Tree J48. The accuracy of the system will be evaluated by implementing these different classification methods. The system architecture of the patient's activity monitoring system is shown as Figure 1 and the flowchart of the system is shown as Figure 2.
The raw accelerometer data is retrieved from the Accelerometer sensor in mobile device. If the Data sending is running more continuously, then it will consume the higher power level, vice versa. Because of that motivation, the raw Accelerometer data aggregated in mobile device using sliding window-based feature extraction to minimize the amount of Raw Accelerometer data into the detailed one.
The higher computation running on mobile device can consume more higher memory consumption, vice versa. Embedding the classification method in mobile device, will consume more power and memory level. Because of that motivation, the classification method is embedded in the server side to minimize the mobile device computation. Furthermore, the current outcomes of the patient's activity (LAYING, SITTING, STANDING, WALKING or RUNNING) will be compared to the last patient's activity to identify the changes. It is a normal change or the abnormal (emergency condition) changes. If it is the normal changes, the system just informs to the user. But, if it is the abnormal changes, the system will notify the user by turning on the notification alarm.  In this patient's activity monitoring system, the goal of the system is to classify the patient's activity in a real time. The mobile device retrieves raw Accelerometer data of the whole patient's activity. For classifying each patient's activity, the system needs to retrieve a set of raw Accelerometer data that represents each of the patient's activity. To retrieve it, the systems apply the feature extraction using sliding window-based feature extraction. The purpose of sliding window-based feature extraction is to retrieve the detailed raw of accelerometer data for each activity and the changes occurred. Sliding window is a technique of extracting data with data sampling where each window consists of a set of detailed raw of accelerometer data [14]. The sliding windows process is shown as Figure 3.
As shown as Figure x, the first set of data is retrieved from the N samples of first raw data D1. For the second set of N data (D2) is retrieved by intersecting some data from set of data D1 and some data after the set of D1 data, and soon. This sliding windows process retrieves the detailed raw Accelerometer data to perceive the detailed patient's activity. The retrieved N samples will be aggregated before sending to the server to minimize the amount of raw Accelerometer data.

B. Activity Classification
In this research, the activity classification is used to classify the patient's activity. Activity classification uses the supervised learning. Supervised learning is a process of mapping an input into the output with the known class of the outcomes. In this research, there are 5 outcome activities, they are LAYING, SITTING, STANDING, WALKING and RUNNING. We implement four classification methods, they are Naïve Bayes [7], KNN [8], [9], KStar [10] dan TreeJ48 [11]. The four-classification method implementation is built for the accuracy evaluation testing. C. Position and its changes In this research, the position data is retrieved to track the patient's position and their position changes. The position tracking is very useful to find the patient's position as soon as possible when the patient is in emergency condition. The monitoring system uses the google maps API [15] to track the patient's position in a real time and also discovering the position changes using the haversine formulae [16]. Haversine formulae is used to find the difference of the last position and the current position.

III. RESULTS AND DISCUSSIONS
In this section, it will be discussed about the system evaluation. The evaluated system running on the experimental environment shown as Figure 1. Based on the diagram as shown as Figure 2, the system needs to be evaluated to discover the system performances. The main contribution of the system is to monitor the self-quarantine patient in a distance without close contacts to the patient. Based on that reason, the system needs to be evaluated to discover how accurate the system is, in detecting or recognize the patient's activity. To evaluate the system performance, in this research will be delivered to two main parts of the evaluations. The first evaluation, we evaluate the accuracy of activity recognition using several kinds of classification methods. We tested four classification methods to evaluate the accuracy of each method in activity recognition. The four classification methods are Naïve Bayes, K-Nearest Neighbor (K-NN), KStart, and TreeJ48.
The second evaluation, we evaluate the impact of N samples on the accuracy of the activity recognition. The purpose of the evaluation is to discover the optimum N samples that provides the best accuracy in classification method in case of activity recognition.
For the both evaluations are tested in Samsung Galaxy Ace GT-S5830 with the system architecture as shown as Figure 1. The evaluation scenario is tested in 300 s with the total of 5 activities (LAYING, SITTING, STANDING, WALKING, RUNNING). The system retrieves as many as 6016 tested data in a total and it is evaluated the accuracy of each classification method using the accuracy formulae (1): Which is each variable in the accuracy formulae defined in the confusion matrix of the classification accuracy as shown as Table 1. When determining the TP, TN, FP and FN is shown as confusion matrix above. In this case, from 6016 tested data, the obtained result shown as  The experimental result in shows that the Accuracy of Naïve bayes 81.25%, KNN 78.125%, KStar 78.125% and Decision Tree J48 75%. Naïve Bayes has the highest accuracy among the others in this experimental result.
The second evaluation is analyzing the impact of the N samples to the accuracy of activity recognition. In the experiment, the system examines the variation of N samples that used in sliding window-base feature extraction. Using sliding window-based feature extraction, we can aggregate the raw data, into smaller amount of aggregated raw data and minimizing the frequency of data sending to the server. When the frequency of data sending minimizing, then the power consumption can be minimized. But, aggregating data (sliding window-based feature extraction) will make the detailed information of the patient's activity lost. If the detailed information of the patient's activity is lost, then the accuracy will decrease too. So, in this evaluation we need examining the variation of the N samples that aggregated in sliding window-based feature extraction and discovering the N samples that provides the most optimum in terms of classification accuracy. The examined N samples varies from 4,6,8,10,20,30,40,50,60,70,80,90 and 100 as shown as Table x. All N samples are tested in 5 activities (LAYING, SITTING, STANDING, WALKING, RUNNING) in 300 seconds. With the variations of N Samples, it impacts the total aggregated data retrieved in 300 seconds. The more N samples, the smaller aggregated data retrieved in a given time. It is shown that the total amount of aggregated data in a given time is different for every N samples. Each of N samples give the different experimental result in terms of the accuracy. The experimental results show that from the given N sample variations, sample with N=6 has the highest accuracy compared to the other N variations with the classification accuracy up to 90.15%. The experimental result is shown as Figure 5.

IV. CONCLUSIONS AND RECOMMENDATIONS
From the experimental result, it can be concluded that this research can be used as self-quarantine patient monitoring system with the Naïve Bayes as the highest accuracy (81.25%) of the classification method for patient activity recognition among the three other classification method (K-NN, KStar and Decision Tree J48). Furthermore, the most optimum N samples used in sliding window-based feature extraction in terms of accuracy is N=6 with the accuracy of 90.15%. For the future work, the system can be developed to improve the activity recognition accuracy using lightweight hybrid-classification method that examine resource limitations on the mobile devices. V.