{'fraction_non_alphanumeric': 0.027930387867223738, 'fraction_numerical': 0.010593150639865776, 'mean_word_length': 5.085685685685686, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Towards Detecting Pneumonia Progression in COVID-19 Patients by Monitoring Sleep Disturbance Using Data Streams of Non-Invasive Sensor Networks

Pneumonia caused by COVID-19 is a severe health risk that sometimes leads to fatal outcomes. Due to constraints in medical care systems, technological solutions should be applied to diagnose, monitor, and alert about the disease’s progress for patients receiving care at home. Some sleep disturbances, such as obstructive sleep apnea syndrome, can increase the risk for COVID-19 patients. This paper proposes an approach to evaluating patients’ sleep quality with the aim of detecting sleep disturbances caused by pneumonia and other COVID-19-related pathologies. We describe a non-invasive sensor network that is used for sleep monitoring and evaluate the feasibility of an approach for training a machine learning model to detect possible COVID-19-related sleep disturbances. We also discuss a cloud-based approach for the implementation of the proposed system for processing the data streams. Based on the preliminary results, we conclude that sleep disturbances are detectable with affordable and non-invasive sensors.


Introduction
Coronavirus disease  is an acute infectious disease caused by Severe Acute Respiratory Syndrome (SARS-CoV) [1]. The authors of [2] reported the discovery of SARS-CoV-2 in December 2019 in Wuhan, China. It is a sometimes deadly disease that mostly affects elderly patients and patients with specific comorbidities, the most frequent of which include hypertension, diabetes, severe asthma, respiratory disease, and cardiovascular disease [3,4].
Tang et al. [5], reported that hospitalized patients mostly have cases of pneumonia, which is the leading cause of fatal failures in the respiratory and cardiac systems [6]. Clinical observations show that the COVID-19 disease can rapidly progress, with a period from hospitalization to death of 15.9 days (standard deviation = 8.8 d) and 12.5 days (8.6 d, p = 0.044) for intensive care unit (ICU) patients and non-ICU patients, respectively [6]. The disease can rapidly worsen, leading to respiratory failure and acute respiratory distress syndrome (ARDS), which requires intubation [7].
Due to the medical systems' capacity constraints in areas where the disease is widely spread, supportive care and patient monitoring are limited. Early detection of pneumonia development in patients in self-isolation at home could enable medical staff evaluation and timely admission to hospital care.
Patients with medium and severe disease experience deterioration in their wellbeing. Symptoms include cough, fever, dyspnea, musculoskeletal symptoms (joint pain, fatigue), and gastrointestinal symptoms [8]. Based on our earlier research [9][10][11], we propose a method for non-invasive monitoring of sleep disturbances, as developing pneumonia could affect a person's breathing and quality of sleep. To establish our assumption that at-home patient monitoring, specifically sleep monitoring, could detect the worsening of the situation of COVID-19 patients or establish if they present a higher risk, in this paper, we review the literature on the relations between COVID-19 and sleep, as well as technology-aided patient monitoring.
In the next section, we provide a review of the literature on the relation between COVID-19, as well as its effect on sleep, and technology-aided patient monitoring. In Section 3, we describe our scenario for non-invasive sleep monitoring, propose a cloudbased approach for sleep disturbance detection, and outline the process for building machine learning (ML) models for detecting sleep disturbances that might indicate underlying COVID-19 issues. The results from the experiments are presented in Section 4. We discuss our findings and future work in Section 5, and conclude the paper in Section 6.

Related Work
To establish our assumption that at-home patient monitoring, specifically sleep monitoring, could detect the worsening of the situation of COVID-19 patients or establish if they present a higher risk, in this section, we review the literature on the relations between COVID-19 and sleep, as well as technology-aided patient monitoring.

COVID-19 and Sleep Disturbances
COVID-19-associated ARDS imposes hypoxia [12], which is an indication of the development of more progressive pneumonia. Patients with hypoxia require urgent medical attention. Smartphone pulse oximetry has been used to detect hypoxia. While pulse oximetry is a direct way to detect hypoxia [13], it has the limitation that the patient must adequately use the equipment and know how to take measurements. It is also challenging to ensure that a person can keep the pulse oximeter attached to their finger during sleep. Due to the lack of oxygen saturation, hypoxia causes sleep disturbances [14]. Sleep monitoring can thus detect potential hypoxia. While false positives from other causes affecting sleep are possible, a further pulse oximetry measurement by the patient or another caregiver can be used for confirmation.
Another aspect of how sleep monitoring could benefit from accessing risk factors for COVID-19 patients is by observing the effects of comorbidities. McEvoy [15] showed that overnight oxygen deprivation caused by obstructive sleep apnea syndrome is a strong predictor of hypertension. Therefore, by extension, obstructive sleep apnea syndrome (OSA) is an indicator of at least one risk factor for COVID-19 patients.
Yi-Fong Su et al. [16] observed 34,100 patients, of which 2757 patients had pneumonia during a mean follow-up period of 4.5 years. This study showed that patients with obstructive sleep apnea syndrome experience a 1.20-fold increase in incident pneumonia. Thus, obstructive sleep apnea syndrome appears to confer a higher risk for future pneumonia. We did not find any similar studies that were specifically for COVID-19 patients; however, Pazarli et al. [17] postulated that OSA may be a risk factor for mortality or deteriorate the clinical scenario with COVID-19. McSharry et al. [18] suspected that OSA could potentially contribute to worsening hypoxemia and the cytokine storm that occurs in COVID-19 patients. Our approach for detecting obstructive sleep apnea syndrome symptoms could benefit in the diagnosis of this risk factor.
Patients with pneumonia who are not on mechanical ventilation are usually positioned so that the affected areas of the lungs are on top [19]. In [9], we showed that non-invasive sensors could be used to recognize motions in bed, including turning in bed from lying on the back to laying on the side. Detecting such movements could alert the caregiver to monitor the care receiver and, if needed, change their body position.

Technology-Aided Patient Monitoring
Improvements in healthcare combined with an aging population with a greater need for health services have strained hospitals and medical staff, which are not always at scale with the needed capacity. This effect has been partially reduced by reducing the length of stay in inpatient hospitals for some patients [20,21]. On the other hand, the tendency to reduce the length of stay in hospitals, which also reduces exposure to hospital-acquired diseases, has created a need for at-home patient monitoring and care. Active monitoring of patients in home settings can improve adherence for patients receiving care at home [22].
Patient monitoring is a growing field of research, and various designs and systems have been proposed. A comprehensive review of remote patient monitoring was conducted in [23]. This study focused on four categories, one of which was cardiovascular and respiratory-related diseases. The review shows that this technology is making an impact on society and the research community. The authors noted that, although researchers prefer to move towards contactless methods, there are still significant problems to be solved in contactless monitoring. These problems include adapting systems for different users and removing artifacts and noise from the contactless sensors. Vegesna et al. [24] conducted a systematic review of remote patient monitoring using non-invasive technologies. This study showed that most systems use multiple components, and smartphones are often involved. A collaborative healthcare system (COHESY) model was described in Kotevska et al. [25]. This model had a bio-network layer for collecting sensor data, a social layer, and a layer for interoperability with healthcare information systems. This system addressed data security issues, such as authentication, privacy, data storage, transmission, and confidentiality.
A system for unobtrusive monitoring of sleep and respiration was proposed in Choi et al. [26]. According to the researchers, the system that used a thin strip pressure sensor to measure the care receiver's sleep efficiency and respiration rate had an accuracy similar to that of existing Food and Drug Administration (FDA)-approved sleep trackers. Two sensors were used in this study: The first one used the piezoelectric effect, and the second was a force-sensing resistor. Once the analog signals were converted into digital signals, they were sent via Bluetooth to a smartphone and onward to an internet server.
Another approach for obstructive sleep apnea syndrome monitoring and detection is through nocturnal pulse oximetry. This approach, studied in Hwang et al. [27], where the authors showed an accuracy of diagnosis of 96.7%. Though the study was done in a hospital setting, the paper showed the potential for home-based use of connected pulse oximetry.
While pulse oximetry provides a more accurate diagnosis for obstructive sleep apnea syndrome, there are many challenges with training care receivers to properly put on the device and consistently do that before sleep. Wearable devices can also fall off or cause discomfort to the patient. Given these downsides, the unobtrusive monitoring with devices that require little or no human intervention can be a more consistent way to measure sleep patterns and sleep disturbances. Shao et al. developed a non-contact blood oxygen saturation (SpO 2 ) monitoring system using camera and dual-wavelength imaging [28]. Their method uses a complementary metal-oxide-semiconductor (CMOS) camera to record photoplethysmography (PPG) signals alternately at two particular wavelengths corresponding to orange and near infrared. Another system for contactless monitoring of blood oxygen saturation was proposed in Casalino et al. [29]. The authors used the plethysmographic signal obtained by monitoring the areas of interest on a person's face to derive an estimation of SpO 2 .

Methods
Our proposed solution consists of non-invasive sensors. We utilize two types of sensors: a piezoelectric sensor (Angelcare, Montreal, QC, Canada) and passive infrared (PIR) sensors (Sunfounder, Shenzhen, China). Other data sources, including patient input and digital medical records, are also introduced into the system. We present a cloud-based architecture to support the care receivers and care providers.

Sensor Kit with Non-Invasive Sensors for Sleep Monitoring
Non-invasive sensors can detect body or leg movements. According to Somers et al. [30], these movements are related to obstructive sleep apnea syndrome. Thus, we propose placing piezoelectric sensors under a mattress, as presented in Figure 1. In this figure, a piezoelectric element is placed between two plates. The piezoelectric element generates a charge, which is amplified by a charge amplifier circuit transmitted via a wall connector to the central panel. The plates were used to amplify the movement of a person in a bed. This sensor's signal was then amplified using a circuit with the schematic shown in Figure S1. Other sensors were also used, such as a passive infrared (PIR) sensor module [9] placed above the bed, as shown in Figure 2. These sensors were placed in a sensor case to provide the experiment with repeatability with a predetermined angle. They were used to detect events, including movements in the bed that were readable by the under-mattress sensors.

Cloud-Based Architecture
To support this study's goals, we propose a cloud-based solution that integrates data from various sources. The cloud infrastructure can also facilitate scalability with the resource demand and cost optimization and can simplify deployments to other locations [31,32]. However, the module for data collection and basic processing should be implemented on an edge device [10] and then sent to the cloud. The sensors can have direct wireless internet connectivity and upload information directly to the cloud in a scenario where cost savings are the priority. However, utilizing the healthcare gateway as an edge device is preferable to offloading initial data processing and enabling faster scaling. Such pre-processing can include basic validation of the user inputs by making sure that they are within reasonable ranges, or more advanced processing based on machine learning, signal processing, or time series analysis algorithms. For example, such methods can be implemented within a mobile application on the edge to identify patterns and measure the results of various functional tests, such as the Heel-Rise test [33], Sit-to-Stand test [34], Functional Reach Test [35], or the Timed Up and Go test [36]. In some cases, these tests' results could be directly calculated within the mobile app and then provided as already-processed results to the cloud.
The process for machine learning is presented in Figure 3. The inputs of the system are sensor data, patient logs, patient records, and medical questionnaires. Ideally, most data inputs would be integrated or facilitated through an intuitive user interface within a mobile application. The sensor data collection is elaborated upon in Section 3.1 and can be enhanced with various functional tests, as mentioned in the previous paragraph. The patient log consists of self-reporting of measurable health parameters, such as body temperature and pulse oximetry. The patient record refers to the medical history of the patient, including any respiratory or sleep diseases. The questionnaire is filled out by the patient. The questions refer to health status that cannot directly be measured, and are thus subjective. Typical questions would include qualifying the person's sleep and a symptom chart for common COVID-19 symptoms, such as loss of smell and dry cough. A medical professional can then provide their diagnosis or introduce additional parameters, such as relevant parameters from blood tests, electrocardiography (ECG) tests, and electroencephalography (EEG) tests [37]. Physicians could also request an examination by directly making an appointment with the patient or requesting additional manual measurements (e.g., pulse oximetry, blood pressure, or temperature) using connected devices or manual input. In case the patient's health is worsening or the health risk is increasing, the medical providers can be alerted or suspected events can be added to the medical record.

Machine Learning with Multi-Modal Data
The diverse inputs can potentially lead to a rich feature set that can be used for training machine learning models. Once the data are collected in the cloud, the machine learning process needs to execute several phases to tackle different challenges that are needed to make accurate predictions. Figure 4 presents the flow of machine learning steps needed to detect sleep disturbances using non-invasive sensors (the PIR module and piezoelectric sensor) and other inputs while considering data from multiple care recipients.

Pre-processing
Data fusion Data transformation Data normalization Data balancing (random oversampling and under-sampling) Generative Adversarial Networks

User-entered data
Oxymeter Temperature Blood pressure  As the non-invasive sensors do not make direct measurements, their placement affects how the events are registered. This introduces challenges in generating machine learning models from multiple care receivers. However, when multiple sensors of the same type are used, the data variations and a temporal difference for the same sensor can be introduced as features in the model. The measured features should be invariant to amplitude or time shifting, uniform amplification, additive noise, and time-scaling transformations [38]. This requires considerable pre-processing for data fusion and data type standardization, considering that there are multi-modal data. First, there are sensory data in time-series format, thus requiring feature extraction and alignment, which could be done with timeseries analysis approaches, such as that of Zdravevski et al. [39], or by using deep learning approaches, such as that of Ordóñez and Roggen [40]. For medical records, questionnaires, and other nominal data, approaches like that of Zdravevski et al. [41], which convert these data into numeric data, are required. These diverse data streams need to be fused, which poses another set of challenges, as eloquently described in [42]. Another challenge is class imbalance, which is common in medical datasets [43]. Traditionally, it has been tackled with the random over-sampling, under-sampling, or SMOTE (Synthetic Minority Oversampling Technique) methods [44]. Recently, generative adversarial networks have been employed for such tasks [45]. Choices are abundant for the machine learning algorithms, and the state-of-the-art and future challenges and research directions for medical datasets were described in Kalantari et al. [46]. Almost all algorithms require some hyper-parameter tuning [47], and their performances can significantly vary on the choice of the cross-validation approach. In the case of medical datasets, which often exhibit a high class imbalance, a leave-one-subject approach is preferable, leading to an overall reliable estimation of the classifier performance [48]. Finally, after the trained machine learning models are deployed on the cloud, they will be employed to make predictions of patients' health. In medical applications, the explainability of predictions is paramount [49], which is the reason for the trending research topic of explainable artificial intelligence (XAI). Two of the most popular methods for explaining the predictions of traditional black-box models are SHAP (Shapley Additive exPlanation) and LIME (Local Interpretable Model-agnostic Explanations), which also have open-sourced libraries that are integrated into other machine learning toolkits [50].

Results
The sampling rate was set to 33 Hz, providing readings from five PIR sensors and one piezoelectric sensor every 30 milliseconds. The different experiments for the monitoring of sleep patterns were performed for over 8 h. The PIR sensors were binary, and in the dataset, they could have a value of zero or one. The piezoelectric sensor used an analog input with a voltage from zero to five volts, represented as zero to 1000. For the analysis, we normalized this range between zero and one. The input range was less than the five volts due to signal noise and voltage drop from the amplifier circuit. The summary of the sensor data input is shown in Table 1. Here, we notice that PIR1 and PIR5, which were facing away from the subject, had a low activation rate compared to the other sensors.  Suppose that we consider a built-in delay in the PIR sensors and a highly oscillating output of the piezoelectric sensor, thus reducing the correlation. In that case, the calculated correlation is very promising. Post-processing of the data can partially eliminate these factors. The delay of the PIR sensors can be reduced by eliminating successive positive values in the time series. The piezoelectric signal oscillations can be ironed out using the sliding window method and then normalizing each event. Figure 6 shows the heat map, where the piezoelectric data were averaged using a sliding window of 100 samples or 3.3 s. The results showed a very high correlation among the PIR sensors of up to 0.83. This is understandable considering that the five PIR sensors had different fields of view, and the pairs of sensors that both captured a portion of the bed in its field of view were the ones with higher correlation. Likewise, there was a very high correlation of up to 0.73 between the piezoelectric sensor and the second PIR sensor, which entirely captured the bed in its field of view. This is quite remarkable considering that PIR sensors produced only binary signals, whereas the piezoelectric sensor had almost direct contact with the person. Detecting this temporal correlation of both sensor types implicates that they can be combined to reduce false positives and increase the confidence level for detecting movements in the bed.
To explore the data in greater detail, in Figure 7, we have visualized the entire sleep interval. As we had close to a million data points for each sensor, we averaged each 30 s interval. Since the sampled data mostly had values of zero, we normalized the data. Each line represents 30 s in the figure, and the vertical length of the line represents the normalized average for that interval. It can be observed that most events detected by the piezoelectric sensor were detected by at least a few of the PIR sensors.
In Figures 8 and 9, we present a heatmap of the sensors for the first and the last 40 min of the sleep interval. A rolling window was used to average the signal, especially from the piezoelectric sensor. We notice that PIR2, PIR3, and PIR4 were activated even for weaker signals from the piezoelectric sensor. These sensors faced the person at an angle with higher sensitivity. When this signal was stronger, which corresponded with more pronounced body movement, even the PIR1 and PIR5 sensors were activated.  We can conclude that non-invasive sensors are likely to register movements during sleep, as indicated by the high correlation. After labeling data using body sensors, the model would process and react only to non-invasive sensors.

Discussion
The proposed non-invasive sleep monitoring system cannot directly be used for COVID-19 diagnosis and is not a replacement for professional hospital monitoring for critically ill patients. However, in situations where the patients are at home, our system can be easily placed in a bedroom to monitor if the patient's situation has an increased probability of worsening by affecting their sleep. Our approach can gather some of the data points needed to further investigate the effects of COVID-19 symptoms and how they affect sleep. However, clinical observation is also needed to precisely monitor the progress of the illness in patients and as a feedback loop to validate the hypothesis that COVID-19 symptoms affect sleep. A machine learning approach is a good fit for this type of analysis given the amount of sensor data generated.
Our system can also be used as an indication of potential risk factors, such as obstructive sleep apnea syndrome. In the related work, we presented research indicating the correlation between sleep disturbances and known effects in patients with COVID-19. A significant association between obstructive sleep apnea syndrome and COVID-19 death was found in Cade et al. [51]. This finding persisted when data were adjusted for demographics. The authors highlighted the need for close monitoring of persons with infection who suffered from obstructive sleep apnea syndrome. The hypoxia associated with OSA significantly affects patients with pneumonia and shortness of breath. The frequent periods of awakening during sleep result in sleep deprivation and poor sleep quality, which are associated with suppression in immune response, which can facilitate susceptibility to SARS-CoV-2 infection [52]. OSA was associated with an increased risk of hospitalization and approximately doubled the risk of developing respiratory failure [53]. Given these risk factors and knowing that OSA is widely under-diagnosed [53], our approach can provide additional information for care providers to investigate and assess a patient's risk.
In our prior research [9], we demonstrated that the data captured by piezoelectric sensors are correlated with a person's movements in a bed by using a video camera. Due to the highly intrusive nature of video cameras, they are inappropriate for obtaining ground-truth data about movements in bed during sleep on a larger scale. Therefore, by confirming that piezoelectric sensor data accurately represent movements in bed, data from piezoelectric sensors can be considered as the ground truth. Even though piezoelectric sensors are inexpensive, the PIR sensors are even more affordable and less intrusive, so in this study, we aimed to utilize them to detect movements in bed. Consequently, they could later be used as indicators of other medical conditions. The experiments showed a strong correlation between the PIR sensors and the piezoelectric sensors. These sensors had entirely different measuring methods, confirming the sensor fusion approach's validity in unobtrusive patient monitoring.
While increased movements during sleep can be associated with COVID-19-related risk factors, such as obstructive sleep apnea and symptoms like hypoxia, restless sleep can be a symptom of other conditions. The stress and fear of being positive for COVID-19 in themselves might affect a person's sleep. The characteristics of the body movements, including frequency, duration, intensity, and the sleep period in which they occur, can be used as input for machine learning models in order to distinguish types of sleep disturbances and identify whether they originate from an illness. Validating this with actual patients with COVID-19 is out of the scope of this work, as this work focuses on establishing the framework and methodology for such subsequent experiments. Considering all safety regulations and recommendations, performing such experiments during the pandemic is simply unfeasible.
Another application that our non-invasive sleep monitoring approach could benefit is the long-term home-care monitoring of patients who survived the acute respiratory distress syndrome (ARDS) and recovered after mechanical ventilation. Prior research has shown that sleep disturbance can increase in post-recovery ARDS patients compared to the general population [54,55]. Lee et al. [54] followed a large group of patients who survived critical illness associated with ARDS and concluded that chronic sleep disorders that originate during the acute illness are present in some ARDS survivors several months after discharge from the hospital. Based on their study and research in the literature, Doria et al. [55] found that by median percentage, 67% of patients in the early stage and 39% in the late stage after discharge experience abnormal sleep.
An additional benefit of using our approach is the assistance in the monitoring of patients with sleep disorders. Many sleep disorder centers were entirely closed during the COVID-19 pandemic either because they were situated in hospital buildings or because the staff was re-tasked with COVID-19 care [56]. While therapy for obstructive sleep apnea syndrome using positive airway pressure (PAP) devices is usually administered at home, sleep monitoring is done in these centers. Given the increased limitations and restrictions, the role of telemedicine for sleep disorders should be prioritized in the era of COVID-19 [57].

Conclusions
In this paper, we showed links between COVID-19 symptoms and sleep disturbances. We presented a system consisting of multiple sensors of two types to monitor sleep quality and issues. Our experimental data showed a strong correlation between diverse types of sensors that detect movements during sleep. We discussed the relations found in the literature between movements in sleep, sleep quality, and sleep disturbances. The monitoring of sleep and sleep disturbances, in turn, can indicate the existence of COVID-19 symptoms, including pneumonia and possible COVID-19 risk factors, such as obstructive sleep apnea syndrome. Our approach can also be used as an alternative home-based sleep monitoring when the patient cannot receive specialized monitoring in sleep centers due to the pandemic restrictions. In the future, we will collect data across multiple persons and various placement configurations of non-invasive sensors. Funding: A.D., E.Z., P.L., and V.T. acknowledge the partial funding by the Ss. Cyril and Methodius University in Skopje, Faculty of Computer Science and Engineering. This work was also partially funded by FCT/MEC through national funds and co-funded by FEDER-PT2020 partnership agreement under the project UIDB/50008/2020 (Este trabalho é parcialmente financiado pela FCT/MEC através de fundos nacionais e cofinanciado pelo FEDER, no âmbito do Acordo de Parceria PT2020 no âmbito do projeto UIDB/50008/2020). This work was also partially funded by National Funds through the FCT-Foundation for Science and Technology, I.P., within the scope of the project UIDB/00742/2020. Furthermore, I.P. would like to thank the Politécnico de Viseu for their support.
This article is based upon work from Sheldon COST Action CA16226 Indoor Living Space Improvement: Smart Habitat for the Elderly, supported by COST (European Cooperation in Science and Technology). COST is a funding agency for research and innovation networks. Our Actions help connect research initiatives across Europe and enable scientists to grow their ideas by sharing them with their peers. This boosts their research, career and innovation. www.cost.eu (accessed on 1 April 2021).

Institutional Review Board Statement:
The study was conducted according to the guidelines of the Declaration of Helsinki and approved by the Institutional Review Board of the Faculty of Computer Science and Engineering at the University Ss. Cyril and Methodius in Skopje, Macedonia. The experiments were performed in a laboratory environment and the participants signed written consent for the data collected during their activities to be used for the study.
Informed Consent Statement: Informed consent was obtained from all subjects involved in the study.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: