# An Intelligent Healthcare System for Residential Aged Care during the COVID-19 Pandemic
## 3 The Proposed Method
The algorithm initializes the light dataset values with R programming and sets up the logic functions by the IES (the Illuminating Engineering Society of North America ([[https://www.ies.org/](https://www.ies.org/)]([https://www.ies.org/](https://www.ies.org/)), accessed on 1 November 2022)) based on initial dataset, computes the categories to enable the dynamic overall detection on the light shift to measure whether the individual is in an indoor environment or not. ```
1. Initialization of parameters: dataset1 < maml.mapInputPort (1) # class: data.framen <- nrow (dataset1) Categories <- c (0)
2. Set up logic functions: for (i in 1:n)[ light <- dataset1 [i,1] if (light >= 0 & light < 120) cm 1 = Dark room if (light >= 120 & light < 250) cm 1 = Dimmed room if (light >= 250 & light < 1000) cm 1 = Bright room if (light >= 1000 & light < 5000) cm 1 = Cloudy if (light >= 5000) cm 1 = Sunny Categories <- c (Categories, cm 1)
3. Compute the indoor and outdoor (IO): data.set <-c bind (dataset1, Categories)

maml.mapOutputPort (\"data.set\");
```  
**Algorithm 1** Indoor and Outdoor (IO) Approach  
The IO algorithm approach takes into account a variety of contextual environments and categorizes them according to their risk factors. Consequently, all environments are labeled as \"indoor\" or \"outdoor\" in order to determine whether the elderly person will be at risk of a fall because noise, lights, and temperature could be important cues for their healthcare, mobile devices with an embedded light sensor can also be used to identify the environment surrounding the user [34]. The second proposed method is a standing and lying (SL) approach. According to the multitasking theory [35], a user is more at risk of falling when performing a secondary task in addition to a primary task. Those behaviors include when elderly people use mobile phones, although the risk is varied depending on whether the user performs the second action while holding the phone or while in the act of putting it down [34; 35]. Consequently, it is important to know whether a user is holding onto or putting down their mobile device. Although a few studies propose mobile sensors for fall detection using gyroscopes, tri-axis accelerometers, and magnetic sensors [5; 33; 36], none of these technologies focus on standing and lying (SL) for multitasking detection [22; 37]. Moreover, to the best of our knowledge, no literature has mentioned SL-based fall detection or usage within a fall detection system. The accelerometer z-axis sensor could be used for detecting standing or lying because we can use the surface of the earth by 9.8 m/s\({}^{2}\) as G (that is, 1 G = 9.8 m/s\({}^{2}\)) when lying. I If the barycenter breaks through a certain threshold, such as \(\theta\), we can conclude that a fall is occurring. Conversely, if the inclination is supported by devices such as crutches, we can measure the value of the acceleration if it is lower than the \(\theta\), which is back to the horizontal plane to avoid the falling. The SL algorithm is presented below (Algorithm 2). The algorithm initializes the accelerometer X, Y, and Z values and sets up the logic functions by the dynamic angle based on initial AccX0, AccX1 and AccX2 and computes the falling points (FP) to enable the dynamic overall detection on the barycenter shift to measuring whether the FP is sufficient or not. ```
1. Initialization of parameters: AccX0, AccX1, AccX2, AccY0, AccY1, AccY2, AccZ0, AccZ1, AccZ2
2. Set up logic functions: Fall_X012 (AccX0, AccX1, AccZ) Fall_Y012 (AccY0, AccY1, AccZ) Fall_Z012 (AccZ0, AccZ1, AccZ2)
3. Compute the falling points (FP): If Fall_X012 && Fall_Y012 && Fall_Z012 >= FP then Fall = yes Else Fall = no End if
```  
**Algorithm 2** Standing and Lying (SL) Approach  
Because elderly people use smartphones, an effective healthcare system should be able to detect their risk level and notify them to protect against falls until their tasks are completed. For these reasons, this SL algorithm approach is an important and novel method in our goal to solve fall accident issues.