A Combination of Indoor Localization and Wearable Sensor–Based Physical Activity Recognition to Assess Older Patients Undergoing Subacute Rehabilitation: Baseline Study Results

Background: Health care, in recent years, has made great leaps in integrating wireless technology into traditional models of care. The availability of ubiquitous devices such as wearable sensors has enabled researchers to collect voluminous datasets and harness them in a wide range of health care topics. One of the goals of using on-body wearable sensors has been to study and analyze human activity and functional patterns, thereby predicting harmful outcomes such as falls. It can also be used to track precise individual movements to form personalized behavioral patterns, to standardize the concept of frailty, well-being/independence, etc. Most wearable devices such as activity trackers and smartwatches are


Background
According to the most recent census statistics, by 2050, the population aged 65 years and older is projected to double in size to 83.7 million in the United States [1].With the increase of this geriatric population, health care utilization will increase dramatically, with a concomitant demand for rehabilitation and in-home care after hospitalization [2].Finding the best way to support patients during rehabilitation, both at facilities and in home, without compromising patient safety is considered to be a significant challenge.The importance of patient safety and rehabilitation has highlighted the need for constant vigilance and fostered methodologies by which patients can be remotely monitored [2][3][4][5][6][7][8].
Numerous studies have investigated the effectiveness of remote patient health monitoring, some suggesting the potential for such technologies to reduce the overall re-admission cost [9].With the advent of wearable devices in recent years, remote health monitoring has evolved and drawn attention, mainly by utilizing physical activity trackers.It is widely assumed that a physical activity regimen implies behavioral patterns that can affect health outcomes.Hence, tracking these patterns and leveraging them may allow the prediction of harmful outcomes, such as falls, in a timely manner.Moreover, tracking individuals' personalized behavioral patterns may allow for the creation of actionable messages to patients and caregivers to improve patient health and outcomes [10].The purpose of this study was to investigate the physical activity and indoor localization features obtained from our remote patient monitoring system, Sensing At-Risk Population (SARP) [2,[11][12][13][14].This study reports on SARP sensor-based markers for rehabilitation screening within a geriatric population, exploring if SARP can be used to prospectively distinguish between at-risk patients in a subacute rehabilitation environment.

Sensing At-Risk Population System Overview
Details of the system architecture with proximity-based sensors (beacons) and a Bluetooth-enabled smartwatch as its main components can be found in the study by Moatamed et al [2] and the patent application by Ramezani et al [14].Building models for physical activity tracking and indoor localization was based on data collected using (1) commercially available Sony SmartWatch 3 with built-in EM7180 ± 2 g triaxial accelerometer, 420 mA battery, and BCM43340 Bluetooth module and (2) proximity beacons (MCU ARM Cortex-M4 32-bit processor with floating-point unit).To build the activity tracking and indoor localization models of SARP system, patients were consented on admission to a subacute care rehabilitation center in Los Angeles.

Bluetooth Low Energy Beacons and Indoor Localization
Beacons broadcast their presence to Bluetooth-enabled devices.Utilizing the beacons' Received Signal Strength Indicator (RSSI) values using smartwatches, the SARP system calculates the proximity of the watch to each beacon, thereby inferring the indoor location of the patient wearing that watch.BLE beacons (bluetooth low-energy sensors) have become popular in gathering contextual awareness because of durability and low cost.When used in health care, however, validating reliability and accuracy of their location information is paramount.Beacons are highly susceptible to diffraction, multipath propagation, angle-of-arrival, lack of line-of-sight, and absorption by the human body.In this project, because locations of interest were within close proximity, we considered RSSI values ranged between −50 dBm to −100 dBm.The average RSSI within the line-of-sight, measured by the watch at 1 feet distance, was −66 dBm.To achieve the best accuracy with respect to locations of interest, shown in Figure 1, considering beacons hardware specification was crucial.Beacon's antenna configuration and the proximity of locations heavily influence the accuracy of indoor localization.Hence, to achieve a high indoor localization accuracy, it was essential to refine beacon placements iteratively.Moreover, in the rehabilitation facility shown in Figure 1, we empirically learned to set the transmission power to −12 dBm and the transmission interval to 250 ms.In studies by Bouchard et al [11][12][13], we proposed a few methods and considerations that can help enhance the indoor localization accuracies.A summary of the ground truth testing executed at the rehabilitation facility shown in Figure 1, with an overall accuracy >80%, can be found in a study by Moatamed et al [2].

Accelerometer Data Processing and Physical Activity Parameters
To infer physical activity of patients in this study, 3-axis raw acceleration signal sampled at 16 Hz was extracted, and the signal magnitude (SM) was initially calculated according to Figure 2, equation 1, where acc indicates acceleration force around each axis in g units including gravity (1 g=9.81 m/s 2 ).The range of the acquired signal is ± 2g.Batches of 160 samples (window size of 10 seconds) were fed to a fifth order Butterworth band-pass filter with cut-off frequencies of 0.5 and 8 Hz.The filtering limited the signal to highlight the frequencies that are most representative of human motion while eliminating the direct current component.Various window sizes ranging from 4 to 12.8 seconds with different overlapping implementations have been used in different studies [15].These characteristics are normally chosen empirically based on feature extraction, activity labeling, and other annotation factors.In this study, a window size of 10 seconds was used with a 1-second overlap [2].After preprocessing the accelerometer data, the next step was to infer human activity (positioning) and to later translate the positioning into a quantifiable metric.However, quantifying the physical activity can be deemed challenging and will be discussed after a brief description of physical activity classification.
A decade has passed since the advent of commercially available low-cost, light-weight accelerometers.The enthusiasm about their potential in extracting physical patterns to usually, but not exclusively, improve health outcomes has led researchers to master the techniques of activity recognition [15,16].Some researchers have even tried to infer activity intensities and predict energy consumption by comparing accelerometer patterns with measured metabolic equivalents [17][18][19].Despite significant and impressive outcomes, the triumph is mostly based on analyzing small cohorts, or often a homogeneous group of people, with similar age or health conditions.Training and testing datasets in most studies are normally collated from people following a certain protocol, whereas in real life, human movements are intertwined, that is, the sequence of movements does not always form a same pattern.As such, the performance of various activity recognition algorithms/approaches applied to real-world scenarios should be taken with a grain of salt [15,16,[18][19][20].The following factors are influential in any human activity tracking algorithm: (1) diversity of human movement habits; (2) variety of human disabilities needing different assistive devices, yielding distinct movement patterns; (3) deficiencies of machine learning algorithms in building one-size-fits-all model; and (4) limitations to distinguish particular motions due to accelerometer placement, for instance, classifying sitting still and laying down with sensor on wrist versus waist [15,20].To reduce the negative effect of the mentioned factors, this study uses a combination of classifications in 3 steps according to algorithm shown in Figure 3.Time and frequency domain characteristics of the signal (main, median, variance, skewness, kurtosis, peak frequency, and peak power) were used as features.SARP initially categorizes activities broadly into walking and stationary.Walking embodies active status, and when stationary, the classifier separates brisk (active) and idle (nonactive) movements and later classifies postures into sedentary, standing, and laying down.Both Tables 1 and 2 depict the summary of physical activity (positioning) classifiers' 10-fold cross-validation results built on 50 patients over approximately 22 hours of collated data at subacute care rehabilitation center in Los Angeles.The algorithms were later validated and refined over the course of 6 months of ground truth testing at the same skilled nursing facility.

Step Counts Versus Raw Accelerometer Assessment
The next stage was to find a way to quantify the difference between different activity status.Step counting is a common way that has long been used to quantify the ambulatory physical activity.However, similar to activity recognition approaches explained earlier, the accuracy of step counters is often the subject of debate among researchers.Comprehensive studies with contradictory results on the accuracy of pedometers and wearable accelerometers can be found in the studies by Crouter et al [21], Mammen et al [22], and Case et al [23].What is rather clear in using step counters/pedometers is their efficacy in quantifying ambulatory activities and not stationary.For step counters to be more accurate, a user is required to satisfy a minimum walking speed that is often mentioned in the literature as 67 m/min or even higher [24][25][26].Therefore, step counters are less likely to produce accurate assessment for less mobile geriatric population.Besides, they are deemed even less effective in quantifying activities in stationary positions.Most studies assess the accuracy of step counters by asking users to walk on a treadmill, which neglects scenarios in which users are stationary, yet pedometers accumulate step counts because of movements in hand.To account for any movements (stationary and ambulatory), this study calculates mean absolute deviation (MAD) of accelerometer magnitude signal using equation 2, Figure 2. MAD calculates the statistical dispersion of acceleration from the mean and its unit is meter per second squared, where x i is the SM in each 10-second window, and the x ave is the average of accelerometer magnitude for 160 samples (10-second epoch×16 Hz).MAD of accelerometer magnitude represents the average magnitude of acceleration within an interval (in this case, 10 seconds) and is proportionate to force applied to the watch by patient since f=ma.This value multiplied into displacement will produce relative work and energy.Take into account that calculating displacement from acceleration, however, is not very accurate because it is the result of accelerometer's double integration, that is, any acceleration jitter accumulates and yields big drifts in displacement.Calculating force, however, is accurate and proportionate to energy; hence, the term energy has been used in this study to quantify human activity movements.
Another way of quantifying activity is to integrate each acceleration channel to produce kinetic energy using e=1/2m.v 2 .This way, however, requires more calculations compared with MAD; for the actual speed, each channel should be considered separately so that the direction of acceleration and deceleration that are removed in SM will be taken into account.
It is worth highlighting that by using a smartwatch accelerometer, it is only possible to calculate the force, proportionate to energy, that is spent on the watch.Hence, if a patient is carrying a weight on the watch-worn hand, the energy expenditure of the patient will not change with regard to the watch.
Active/nonactive is determined in this study using an empirical threshold of 0.02 m/s 2 (2 cm/s 2 ) over the MAD value.As explained earlier, calculating displacement from the accelerometer is not highly reliable.However, for illustrative purposes, assume the initial speed of hand movement in each window of 10 seconds is zero.Using equation 3 shown in Figure 2, the value 0.02 indicates that a patient's hand displacement has been 1 m in 10 seconds.In case of equal or greater shifts, the patient is considered active, otherwise, idle (nonactive).

Overview
From June 2016 to November 2017, we recruited patients after admission to a subacute rehabilitation center in Los Angeles.We performed a cross-sectional baseline study of this cohort to better understand data features collected by the SARP system.We investigated the prevalence of physical activity tracking features and indoor localization features at baseline for both outcome groups (hospital vs long-term care).Moreover, we assessed their efficacy in determining the outcome (hospital vs long-term care).

Participants
Participants aged older than 60 years were recruited from a subacute rehabilitation facility in Los Angeles.The study cohort contains patients who had been admitted to a subacute rehabilitation center for 21 days.After this period, patients were either re-admitted to hospital (H) or stayed in community (C; either at home or long-term care).The inclusion criteria were broad, allowing any patient to participate as long as they were aged older than 60 years, English speaking, and able to consent with the exclusion criteria including movement disorders or paralysis of the upper or lower extremity.The diversity of cohort included patients who were a postsurgical, poststroke, and postclinical decompensation because of medical illnesses.Eligible participants signed a consent form approved by the University of California, Los Angeles, Institutional Review Board.

Study Design
Patients were given a smartwatch by a clinical coordinator every morning at 9 am.Patients were asked to wear their watches at all times until the coordinator collected the watch at around 6 pm every day.Watch batteries were expected to last longer than the protocol period (>9 hours).Patients normally stayed in the resident room (bedroom) and were scheduled for an hour of daily exercise and activity in the therapy room.Beacons were mounted at locations of interest (Table 3), shown with color dots in Figure 1 within bedroom and therapy room.Take into account that despite imposing an identical protocol for all patients, daily collected data from each individual may differ.This is primarily because of patients not complying with the protocol at all times, losing interest during the day, feeling uncomfortable, and getting concerned about their privacy.Therefore, to provide a situation in which a fair comparison among patients can be enforced, we determined analysis inclusion criteria.

Analysis Inclusion Criteria
For this baseline analysis, we included study participants who satisfied the following constraints: (1) patients with 4 hours or more of watch wear time data in at least 1 day within the first 3 days of admission (defined as baseline); and (2) having 15 min or more of therapy room wear time in that particular baseline day.In case both inclusion criteria were satisfied on more than 1 day, the earliest day was selected as baseline.The reason for choosing 4 hours or more wear time was to set a standard minimum; given the health of this population whom mostly recently discharged from the hospital, we anticipated variability in watch usage.To have a minimum standard, we agreed that patients needed to wear the watch more than 50% of the available hours per day (in this study, 8 hours).
The hours when the watch was not worn were excluded from the study; therefore, baseline hours may not be consecutive.

Demographic and Clinical Characteristics
We collected the demographic characteristics of patients such as age, race, gender, and ethnicity.We also translated the clinical coordinator's assessments including usage of assistive devices and their type, measures of activity of daily living (ADL), pain (yes/no), and number of active diagnosis (more or less than 10).We investigated the significance of such characteristics in distinguishing the outcome (community vs hospital).

Sensor-Based Parameters
Sensor-based features are combination of 3 groups of parameters that are achieved by harnessing smartwatch and BLE beacons.The features are based on (1) activity recognition such as sitting time and standing time; (2) indoor localization, for example, time in bed, time in bathroom, or therapy room; and (3) row acceleration quantification, MAD (energy; see section Sensing At-Risk Population System Overview).By combining these attributes, we achieved features such as sitting time in bed or energy spent in walking or in bed.
To perform a fair comparison among patients with different watch wear time, we normalized features: time spent (minutes) in a certain physical activity or location was divided by uptime (the total watch wear time in a day in minutes) to yield normalized time features.Uptime is an essential factor in providing fair comparison We investigated the significance of sensor-based features with respect to the outcomes: hospital versus community.All measurements are at baseline, that is, the day that satisfies inclusion criteria from 9 am to 6 pm.We calculated "time spent in percentage," "energy intensity (E)," and "energy spent in percentages," as shown in equations 4, 5, and 6 in Figure 2.
To recap, for each individual, time-related features such as sitting time were divided by uptime.Energy-related features such as walking were divided by: (1) the uptime, yielding energy intensity and (2) their total daily value, producing the energy percentage.

Statistical Analysis
We explored the capability of baseline sensor-based and demographic features to distinguish between subacute rehabilitation patients based on their outcomes (ie, re-admitted to hospital (H) vs staying in the community (C) either long-term care or home).Chi-squared tests were used to compare categorical demographic variables between outcome groups.We compared quantitative demographic variables and sensor-based metrics (physical activity derived from watch accelerometer and indoor localization inferred from BLE beacons RSSI) between groups using the Kruskal-Wallis test.Cohen d was used to summarize the effect size and illustrate the discriminatory power of each feature.Commonly, 0.2, 0.5, and 0.8 are Cohen d cut-off values indicating small, medium, and large effect size, respectively.Spearman rho was used to measure correlations between physical activity and location-based features.

Predictive Models of Outcome
We investigated the capability of features at baseline to triage and predict patients who were re-admitted to the hospital or who stayed in community.We built random forest models (maximum depth=2, random state=40, and class_weight=balanced), with hospital patients as positive group.We used single or combination of features with highest statistical significance in distinguishing outcomes according to Kruskal-Wallis tests.Model generation and evaluating performance characteristics (3-fold cross-validation) including sensitivity, specificity, accuracy, and area under the curve (AUC) estimation were performed using Python Programming Language libraries Pandas (version 0.21.0) and Numpy (version 1.14.5),Scipy (version 1.0.0), and Scikit-learn (version 0.19.1)[27][28][29][30].

Demographic and Clinical Characteristics
From 184 consented subjects, 30 were excluded because of not satisfying the analysis inclusion criteria.A total of 154 patients were included in this study in which 145 (94.2%) of subjects discharged home/community (C), and 9 (5.8%) re-admitted to hospital (H) at the end of their rehabilitation process.Table 4 presents detailed sociodemographic and clinical characteristics of this cohort, such as age, gender, race-ethnicity, presence of pain, number of active diagnoses, usage of assistive devices, and ADL.Table 4 indicates the mean (SD) and number of patients included for every particular parameter.Among the clinical assessments, Table 4 shows that ADL Toilet is significant in determining the outcome (P=.007) with 65% of the cohort in need of extensive assistance and 35% limited assistance.

Energy Intensity Features Assessment
Amongst sensory-based features shown in Figure 2, equations (4-6), energy intensity features are the ratio of the total energy spent in a particular activity or location to their corresponding time spent.Taking into account, indoor localization capability of SARP system enabled us to calculate the energy spent at each location of interest, sum of which was broadly categorized into (1) energy intensity in resident room and (2) energy intensity in therapy room.According to Table 5, energy features that best discriminated community and hospital patients were energy intensity in resident room (P<.001, d=1.21), resident_bed (P<.001, d=1.23), resident_bath (P=.004, d=1.18), and total energy intensity (P=.003, d=0.87).Features such as energy intensity of laying down (P=.02), and therapy_bathroom (P=.02), despite statistical significance, have low effect sizes (d=0.418 and d=0.17, respectively).Moreover, with P<.001 and d=1.25, energy intensity in resident room has high discriminatory power with respect to outcome.c Not applicable (the P value or effect size cannot be calculated).
Figure 5 depicts the energy intensity distributions between 2 groups in resident and therapy rooms.It shows that energy intensity in therapy room in both groups has similar mean value (line within the box); therefore, a clear distinction cannot be made within 2 groups based on that feature.However, the mean value of community group in resident room is clearly higher than in hospital patients.
Kernel density estimation (KDE) distributions are shown in Figure 6 (subplots A and D).The figure attests to the distinction of energy intensity in resident room among community and hospital patients (subplot A).However, the KDE of energy intensity in therapy room (subplot D) does not indicate the same discriminatory power.Figure 6 (subplot B) indicates that energy intensity of most patients in therapy room is higher compared with resident room for both outcome groups because most patients fall below the identity line.Points shown on the identity line represent patients with same therapy and resident intensities.
According to subplot (C), the center core of the contour plot (representing most patients) in community group is almost circular contrary to hospital patients.This indicates that the ratio of resident to therapy intensity is closer to one (ie, same activity intensities).On the contrary, more oval shape of the contour core in hospital group can imply that most patients are persistently more active during therapy sessions while being less active in their resident room.The increase in energy levels can be seen clearly in Figure 7.The figure depicts the ratio of energy intensity in therapy room to resident room.Most patients in hospital outcome group, demarcated by red line, fall around number 2. In other words, therapy room energy intensity is twice the resident room for most patients in hospital group.However, 50 patients in community group (blue histogram) have the ratio close to 1, that is, the same intensity in both therapy and resident room.A more detailed scenario of both groups within the therapy room can be found in Figure 8 and Table 6.Average time spent and energy intensity at each therapy location stratified by groups are shown in Figure 8.It is clear that hospital group spent no time at stairs, scifit, table, and endorphine.The 5 most intensive activities were small table, stairs, scifit, table, and bike.Small table and table are places where patient normally carried out hand pedaling exercises.Table 6 further highlights the details of therapy room location/facility usage in each group.More than 70% of participants from both groups had used bed and bathroom in therapy room, with bathroom 's P<.05 (Table 5).However, it is worth mentioning that the effect size of bathroom energy intensity is small: 0.17 (cut-off regions: 0.2 small, 0.5 medium, and 0.8 large).Furthermore, Figure 8 reveals that both groups' intensities at bed and bathroom were less than 60 per min.In a study by Razjouyan et al [8], a cutoff point of 90 is suggested to differentiate between light and moderate-to-vigorous activities.According to annotations explained in the Features section, E indicates energy intensity, E% denotes energy percentage, and T% shows the percentage of time spent.Circles, contrary to ovals, correspond to low correlation, whereas lines imply the highest correlation.Darker spectrum on either side (red or blue) represents higher correlation; red implies positive, whereas blue is indicative of negative correlation.It is clear from the figure that laying down is negatively correlated with the rest of the features.Bath and bed in resident room are understandably correlated strongly with energy spent in resident room because almost all activities happened in those 2 locations, and patients hardly used the chair.Bed, bath, resband, small table, bike, and scifit are strongly correlated with energy spent in therapy room.It is clear that being active is highly correlated with overall energy intensity.Resident room energy intensity is strongly correlated with overall energy intensity.

Energy Percentage Features Assessment
Energy percentage feature, as mentioned in Figure 2, is the percentage of energy spent in walking, sitting, standing, laying, or energy spent in locations of interest divided by total energy spent in that day.According to Table 5, community patients are more active (P=.001,d=1.24) than patients re-admitted to the hospital.Meanwhile, energy percentage of standing (P=.002, d=1.24) and sitting (P=.02, d=0.86) of the community group is higher than those in hospital group.Other than walking, all energy percentage parameters were shown significant in distinguishing between both groups.Walking is not significant in distinguishing the outcome: Energy (%) in walking (P=.08, d=0.50) and energy intensity during walking (P=.44, d=0.34).

Time Features Assessment
According to Table 5, standing time (%) has the strongest discriminatory power (P<.001, d=1.51) among all watch-derived parameters.Community group has higher time percentage in laying down (P<.001, d=1.35) and active state (P=.001, d=1.24) compared with hospital group.Despite statistical significance of sitting time (%), its effect size is between small and medium (P=.04, d=0.31).Walking time was quite negligible (<1% of time for both groups with P=.09, d=0.44), whereas overall active state, which captures walking and stationary active periods, was highly significant (P=.001, d=1.10).As shown in the table, none of the time (%) parameters in resident room have the ability to discriminate between the 2 outcome groups.

Performance of Predictive Models at Baseline
Random forest models were built based on the most statistically significant features.In reviewing Table 4, the top 3 most influential features in distinguishing the outcomes were % standing time (P<.001,d=1.51), % laying down time (P<.001,d=1.35), and resident room energy intensity (P<.001, d=1.25).Results of 3-fold cross-validation models with their corresponding AUC score are presented in Table 7.Take into account that the sensitivity (recall) presented in the table is not the weighted average and reflects only recall of minority (H) group.Specificity indicates the true negative rate when negative group is comprised most patients returning to community setting (C) after the rehabilitation period.

Discussion
To our knowledge, this is the first study that has combined indoor localization and accelerometer-based physical activity recognition to assess older patients.A subset of indoor location and physical activity features were found to be highly correlated with the outcomes (community vs hospital re-admission) at baseline.In this section, we discuss the significant highlights of the result.

Steps Versus Raw Acceleration Signal
Interestingly, walking, a known distinctive parameter in assessing physical functional performance in certain older populations [8], did not yield significance in this study.In populations that are frail, similar to that in subacute rehabilitation, only a negligible amount of time is spent walking (<1% of daily activity).This suggests that in these populations, steps counters may not necessarily be the best way to quantify active state [24,25].It would be best to prepare for the stark reality that geriatric population may not be active enough to assess their well-being or infer their independence only based on step counts or by monitoring their walking.A combination of activity features that includes both wearable sensor and stationary beacons that provide corresponding indoor localizations could be a stronger indicator of their general well-being and/or frailty.Moreover, the use of raw acceleration signals to quantify energy intensity allows us to capture even XSL • FO RenderX small movements, the movements that may not trigger step counters but still indicate some level of activity.Let us consider an example in which we considered energy spent rather than steps: compared with community, hospital patients show higher percentage of energy while laying down (P=.39, d=0.54).They also spent more overall time (%) in that position (60.99)compared with 46.83 for community patients.However, energy intensity of community patients is higher than hospital patients (26.23 vs 19.54).This indicates that community patients have been more active while lying down.Being more active while lying down may be the result of turning in bed; hence, this feature may denote higher ability to move in community patients.In this scenario, as discussed earlier, step counters will not produce reliable results to quantify patients' activity levels.

Activity With Therapist Versus Resident Time Alone
One interesting aspect of this study was to investigate the activity while a patient is with a physical therapist versus activity during the other hours of the day.It did not appear that a clear distinction could be made between different outcome groups based on therapy room energy intensity.This could be because all patients during therapy sessions are engaged by the therapist in similar physical activities following set protocols.However, the energy intensity of resident room was distinctive within outcome groups.

Value of Indoor Localization Data
To assess the value of indoor localization in activity tracking, it would be best to highlight some of the scenarios: according to Table 4, among clinical characteristic assessment, ADL toilet (P=.007) was the most significant feature in determining the outcome.This feature corresponds to the watch-derived feature energy intensity in resident bathroom.With P=.004 and effect size of d=1.18, energy intensity in resident room (achieved from indoor localization) hence confirms the clinical finding and can be considered in the absence of ADL evaluations.In other words, ADL variant, a highly significant clinical feature, can be replicated using combination of indoor localization and activity/energy derivations.
Both group energy intensities at bed and bath were less than 60 per min.In the study by Razjouyan et al [8], authors use a cutoff point of 90 to differentiate between light and moderate-to-vigorous activities.On the basis of that, given the intensity in both bathroom and bed for either of the groups, we can conclude that patients performed light activities in those locations.
None of the patients in hospital outcome group used therapy room toilet/bathroom.It is likely that those patients were not capable enough to perform such exercises or even not advised by clinicians/nurses to do so to prevent injury.Either way, the lack of performing an activity, in this case, information extracted from indoor localization data, could be an early indication of which group a patient belongs to; it could also potentially be used to identify adverse outcomes and proactively address to prevent a negative outcome.

Predictive Analysis: Statistically Significant Features
P value as statistical significance or strength of evidence index has long been a subject of debate [31,32].It is very crucial to know that the P value is not a definite test; increasing more attributes significantly correlated with the outcome variable in a predictive model does not necessarily yield higher predictability.Although statistical significance index and its effect size provide a standard exploratory data analysis and perhaps a good informal heuristic for choosing attributes of a prediction model, machine learning practice has more freedom from model assumptions.This study shows that the addition of significant variants did not increase predictive power and the model with only energy intensity in resident room produced the highest recall of minority class (hospital outcome) and overall AUC (0.84).
Considering only the prediction results, we can infer that location data add value to our system.It is apparent that energy intensity in resident room is the most decisive feature in predicting the outcome.

Limitations and Future Research
Activity classification can best be obtained using a series of motion sensors placed on various parts of the body.Thus, a wide range of activities can be captured as most body motions are detected.However, to simplify the activity detection, using single motion sensors is quite popular.Placing an accelerometer on the hip has been one of the most popular methods because it captures almost all human motions; however, it underestimates the arm ergometry, as it cannot fully extract the arm movements [33].Wrist-worn accelerometers are popular because of their ease of use, water resistance in most brands, and capturing a comprehensive set of activities.However, interpreting their data for certain sedentary activities such as sitting, standing, and laying is rather challenging, in that, hand movements are very similar in those scenarios.Although ambulation detection is evident in most cases, error rates of classification increase when using assistive devices, walking in very low speed, carrying a weight with the hand that is not wearing the watch, or doing activities involving hand and feet movement together such as sweeping [15,33,34].
Patients' compliance with wearing a smartwatch was the main challenge of this study, and we expect it to be a generic obstacle in similar studies that aim to harness wearable technology for patients.Moreover, if the target population is less familiar with new forms of technology such as wearable devices, the compliance issue might become even more crucial.In this study, we recruited 184 patients, of which 30 patients were excluded for not satisfying the analysis inclusion criteria (watch wear time constraint).Our baseline analyses revealed that 50% of patients removed their watches before the study coordinator collects them at the end of the 8 hours.
Dealing with medical datasets is rather challenging in that the datasets predominantly consist of normal cases in addition to minority abnormal instances that deem to be more interesting [35].Many attempts have been made to overcome the obstacle of the normal and abnormal samples known as imbalanced datasets.There exist approaches to improve the performance of predictive models by oversampling and/or undersampling the dominant and abnormal instances [36][37][38].In our study cohort, the 2 outcome categories are not equally represented, making the dataset imbalanced.In the future, we aim to further investigate the use of oversampling and undersampling of our dataset as methods that perhaps are not very conventional in the medical field but can possibly improve the predictability of our models.
Next step would be the longitudinal analysis on the same study cohort over the 21-day period they were admitted to the same rehabilitation center.This will allow us to track the trends in sensor feature values and investigate if their changes mimic the daily assessment change performed by clinicians.The result can allow development of models of early frailty detection or producing intervention alerts.

Conclusions
Despite the evolution of eHealth and mobile health (mHealth) and the emerging role of wearable and mobile technology in new platforms of health care, there are anecdotal claims that wearable technology may not precisely quantify patients' health [39].In this study, we showed that wearable technology, equipped with refined physical activity tracking algorithms, in our case, tailored for geriatrics, can result in a better understanding of patients and hopefully pave the way in developing intervention alerts and approaches.We discussed how SARP features provide a clearer storyline of daily activity patterns by merging indoor localization with physical activities.The SARP system can be incorporated into mHealth technology platforms and can provide a more objective assessment of the frail population.

Figure 1 .
Figure 1.Subacute rehabilitation facility map: resident room on top and therapy room at the bottom with locations of mounted beacons shown in red.

Figure 4
Figure 4 shows 10-second examples of acceleration SM of a person.It illustrates the difference in walking, active and nonactive stationary positions.

Figure 4 .
Figure 4. Magnitude of accelerometer signal after filtering (direct current component removed before filtering).

a
Effect sizes have been calculated as Cohen d. b Parameters with P<.05.

Figure 8 .
Figure 8.Time and energy intensity details of therapy room.

Figure 9 illustrates
Figure9illustrates Spearman correlations among features.According to annotations explained in the Features section, E indicates energy intensity, E% denotes energy percentage, and T% shows the percentage of time spent.Circles, contrary to ovals, correspond to low correlation, whereas lines imply the highest correlation.Darker spectrum on either side (red or blue) represents higher correlation; red implies positive, whereas blue is indicative of negative correlation.It is clear from the figure that laying down is negatively correlated with the rest of the features.Bath and bed in resident room are understandably correlated strongly with energy spent in resident room because almost all activities happened in those 2 locations, and patients hardly used the chair.Bed, bath, resband, small table, bike, and scifit are strongly correlated with energy spent in therapy room.It is clear that being active is highly correlated with overall energy intensity.Resident room energy intensity is strongly correlated with overall energy intensity.

Table 3 .
Locations of interest.For sensor-based feature assessment throughout the paper, shower, toilet, and sink are considered as bathroom; walls 1, 2, and 3 as wall; beds 1 to 4 inside the therapy room and beds 1 and 2 inside the resident room as beds.

Table 4 .
Sociodemographic and clinical characteristics of the cohort of 154 patients.
a Not applicable.b ADL: activity daily living.c Parameters with P<.05.

Table 5 .
Sensor-based (activity and indoor localization) features: assessment according to outcomes.

Table 6 .
Frequency of therapy room location/facility usage by group.
a Parameters with P<.05.