IoT-Based Patient Movement Monitoring: The Post-Operative Hip Fracture Rehabilitation Model

Hip fracture incidence is life-threatening and has an impact on the person’s physical functionality and their ability to live independently. Proper rehabilitation with a set program can play a significant role in recovering the person’s physical mobility, boosting their quality of life, reducing adverse clinical outcomes, and shortening hospital stays. The Internet of Things (IoT), with advancements in digital health, could be leveraged to enhance the backup intelligence used in the rehabilitation process and provide transparent coordination and information about movement during activities among relevant parties. This paper presents a post-operative hip fracture rehabilitation model that clarifies the involved rehabilitation process, its associated events, and the main physical movements of interest across all stages of care. To support this model, the paper proposes an IoT-enabled movement monitoring system architecture. The architecture reflects the key operational functionalities required to monitor patients in real time and throughout the rehabilitation process. The approach was tested incrementally on ten healthy subjects, particularly for factors relevant to the recognition and tracking of movements of interest. The analysis reflects the significance of personalization and the significance of a one-minute history of data in monitoring the real-time behavior. This paper also looks at the impact of edge computing at the gateway and a wearable sensor edge on system performance. The approach provides a solution for an architecture that balances system performance with remote monitoring functional requirements.


Introduction
Hip fracture is a critical life-threatening injury and has a serious, long-term, and devastating impact on a person's physical functional performance. It is a common event among members of the older population (aged 60 and above) and causes substantial problems with a person's ability to live independently, movement restrictions, a reduction in well-being, and other health-related concerns [1][2][3]. Rehabilitation is a form of therapy whereby patients perform different types of movements, activities, and physical exercises. It plays a pivotal role in restoring physical functionality, healing the injured hip, and supporting muscle strength. Evidence shows that intensive rehabilitation plays a role in functional performance, quality of life, and achieving optimal rehabilitation outcomes [2][3][4][5][6].
Several rehabilitation programs are available that aid in the improvement and recovery of physical function and mobility. However, each program's efficacy is ambiguous as rehabilitation mostly occurs while the patient is living independently and unsupervised [2,5]. Furthermore, to avoid improper exercise, continuous long-term monitoring of movements during activities by a physical therapist and the rectification of improper movements are essential [4].
Therefore, it constitutes a critical global challenge as healthcare professionals lack the historical data on a patient's short-term movement that are needed to help the patient succeed in achieving their personalized recovery goals. To address such challenges, we 1. This paper enhances the post-operative hip fracture recovery model that we published in our conference paper [2]; 2.
This paper suggests an IoT-based movement monitoring system that supports the model's implementation; 3.
This paper analyzes the data collected on the core rehabilitation movement and offers approaches that improve the movement's recognition; 4.
This paper attempts to utilize the available computational resources in the Cloud, at the gateway edge, and at the wearable sensor edge to support the system's performance.
The organization of this paper is as follows. Section 2 presents a critical analysis of the literature pertaining to the hip fracture rehabilitation process, activity recognition methods, and IoT-enabled system architectures within rehabilitation healthcare. Section 3 illustrates the proposed post-operative hip fracture rehabilitation model, leading to the clarification of the involved process and associated events as well as the main movements of interest. Section 4 discusses the architectural representation of the IoT-based rehabilitation movement monitoring system. Section 5 discusses the system performance in possible scenarios of architectural implementation while taking into consideration the available network functions, information transparency, and the wireless sensor's lifetime. Future directions and conclusions are presented in Section 6.

Related Work
Over the last decade, many scholars have conducted extensive research in the area of post-operative rehabilitation of hip fracture patients [4]. Different exercises and activity movements to be performed during rehabilitation have been proposed [16,17]. On top of surgical therapy, post-operative rehabilitation exercises for patients with a hip fracture have gained further attention. Findings indicate that the majority of patients are not able to return to their pre-functional level a year after the surgery. Furthermore, even after a 2-year follow-up, patients are likely to spend their time on their feet or doing prescribed exercises and lack independence in performing the basic activities of daily living (ADLs) [18].
It is believed that there is a high chance of neglecting the exercise program following the discharge which could lead to the interruption of rehabilitation instruction [4]. As a result, a patient's post-operative function can be promoted if a continuity in the rehabilita-Future Internet 2021, 13, 195 3 of 19 tion guidance from the hospital to the home is maintained. Recent studies have shown the effect of home-based exercise programs in strengthening muscle, healing fractures, as well as improving the quality of life and functional performance [4,19]. However, evidence and a standardized-based approach for the treatment in the patient rehabilitation process are lacking. Therefore, a more task-based structural rehabilitation program [4] in addition to a continuous active monitoring system can provide pervasive and personalized healthcare treatment which this paper aims to address. This could cater to the needs of both healthcare professionals and patients in accelerating the return of physical functionality [8].
The recognition of human limb movements plays an important role in distinguishing information about the human psychological state and daily physical changes. Many scholars have contributed to activity recognition across a wide range of applications such as posture recognition [20], fall detection [21,22], human tracking [23], and gesture-based movements [24]. Many different activity recognition methods for data analysis such as digital signal processing [25], time and frequency domain features extraction methods [26], as well as statistical, inclination angle and threshold-based methods [27][28][29] have been used in the classification of static, gait-related activities, rehabilitation movement activities. All of these proposed methods are somewhat associated with the hip fracture patient monitoring system. However, all the techniques used by different researchers have based their recognition algorithm on the axis-dependent technique. This might not always be feasible as it restricts the user to wearing the sensor in a specific orientation. This paper addresses this gap by using a technique similar to that proposed by the authors in [3]. Moreover, it highlights the significance of personalization over the subject's overall movement behavior when recognizing a particular activity.
With the development of fitness trackers, smartwatches and Web-enabled glasses, wireless body-worn sensors have gained significant popularity in healthcare monitoring applications and medical use cases [10]. They play a central role in acquiring the patient's activity movement data, which are responsible for the recognition of the activity movements and controlling the overall movement monitoring process. It has been realized that IoT-enabled wearables [10] are becoming quite attractive in healthcare monitoring applications, as these make the healthcare system transparent and cost-effective as well as allow personalization, improved outcomes, provide high-quality care, reduce diagnostic time, and enable the effective utilization of the collected data which are accessible from anywhere and at any time.
A strong synergy exists between the unprecedented advancements made in the Internet of Things (IoT) and the emerging demands of healthcare applications. IoT could support the healthcare system, allowing people to reside and be supervised at home instead of being sent to clinics or hospitals. A recent article surveyed the significance of healthcare IoT from clinical perspectives by discussing its current trends, application demands, and challenges [30]. Moreover, many novel healthcare monitoring systems using machine learning techniques have been proposed and researched for advancing all healthcare applications [31]. The authors in [32] proposed a novel healthcare monitoring system framework based on ontologies and bidirectional long-term short memory (Bi-LSTM), which can precisely analyze and store healthcare data and improve recognition accuracy. This novel approach is being applied to healthcare data related to BP, diabetes, and mental health. The model has been proven to be quite effective in enhancing the performance of heterogenous data handling and improving classification accuracy using various sources of patient data. A smart healthcare monitoring system for the prediction of heart disease using ensemble and deep learning and sensor fusion techniques has been proposed and implemented by the authors in [33]. The experimental results show 98.5% precision in terms of recognizing the disease, which is higher than that of existing state-of-the-art systems. Another recent article [34] used the machine learning technique to predict circulatory failure in an intensive care unit. The proposed approach predicts 90% of circulatory failure events in test sets, among which 82% were recognized 2 h in advance. This shows that the implementation Future Internet 2021, 13, 195 4 of 19 of machine learning techniques could make the system more seamless and precise in classification in handling the large amount of unstructured healthcare data. In addition, many scholars have proposed and implemented IoT-based architectural system solution in applications including stroke and knee rehabilitation [35], bed egress [36], fall detection [22] as well as sleep [37], respiratory [38], cardiac [39], and glucose monitoring [40].
However, there has been less of a focus on certain other applications such as hip fracture rehabilitation [6]. The details of a typical solution to the follow-up of a process such as post-operative hip fracture patient rehabilitation will be explored and addressed in this paper.
Different multi-layer IoT-based architectures that involve wireless sensing, data processing, communication, edge computing and Cloud computation have been proposed [1,8]. Wearable IoT-based three-layered architectures for personalized [41], home-based healthcare services [42] have also been proposed. This section discusses the functionalities of various architecture layers and their benefit for clinical healthcare monitoring applications.
The SPHERE project offered an architecture for the identification and administration of healthcare conditions and aimed to integrate different sensing modalities into an IoT solution for AAL [43]. Home health hub IoT (H3IoT) designed a simple layered architecture for monitoring of the health of aging occupants and could be extended and modified to suit clinical and emergency-based healthcare monitoring systems [44]. In addition to the proposed design, the focus is now shifting from centralized to decentralized IoT architectural approaches. In the centralized approach, IoT devices directly forward data to the Cloud before any decision making takes place. This means that all the computational resources are placed within the Cloud. As a result, this could lead to challenges in handling the overhead on the used devices, as well as the latency and increased size of data traffic. In contrast, in the decentralized approach, the resources are utilized across all layers, i.e., from IoT wearable devices to the gateway/edge and Cloud layers [8]. In doing so, the computational and decision-making capabilities are distributed, reducing the data packet transmission size and communication delay time. This concept has not been applied to healthcare monitoring applications and could offer great potential if implementing as part of our proposed monitoring system architecture. However, some of the other promising challenges such as communication latency, wearable energy efficiency, activity recognition reliability, and solution scalability need to be discretely and collectively addressed, as further research efforts are required to address such concerns.
The consideration of the aforementioned factors could be of great interest while offering an overall IoT-enabled wearables system design for a long-term rehabilitation movement monitoring system architecture, as described in Section 4. The following section illustrates the post-operative hip fracture rehabilitation movement process that could support the development of an online movement monitoring system.

Post-Operative Hip Fracture Rehabilitation Model
Following the hip fracture operation, the patient is required to follow a structured rehabilitation program for the recovery of the affected muscles. Many researchers have evaluated the effect of physiotherapeutic exercises and activity movements following surgery [4,6]. However, the obscurity of the existing rehabilitation care plan and services means that the chances of achieving and improving a patient's recovery outcomes when undergoing rehabilitation remain uncertain. This paper utilizes a generic post-operative hip fracture rehabilitation model that has been previously published [2]. The model, as shown in Figure 1, highlights the key stages involved, the activity types and movements, the required exercises' frequency and duration, with illustrations of the movements to mimic [2].
The rehabilitation process involves three phases, i.e., supervised rehabilitation at the hospital; unsupervised/guided rehabilitation at home; and unsupervised rehabilitation outdoors. These three phases are spread across four different stages: stages 1 and 2 constitute the first rehabilitation phase which aims to improve a patient's independence through bed mobility and a range of functional motion exercises. These exercises allow the patients to be safe ambulators within their home environment. Stage 3 refers to the second rehabilitation phase where an exercise program is provided to a patient by a hospitalbased physiotherapist. The prime focus here is to improve lower extremity physical ADLs, particularly ambulation. The activity movements involve aids to increase joints' range of motion and muscle strength. Stage 4 is the last stage of the rehabilitation phase which allows patients to ambulate outside the home environment. This phase helps to boost their confidence, improve their mental health, and re-integrate within their local community.
shown in Figure 1, highlights the key stages involved, the activity types and movements, the required exercises' frequency and duration, with illustrations of the movements to mimic [2].
The rehabilitation process involves three phases, i.e., supervised rehabilitation at the hospital; unsupervised/guided rehabilitation at home; and unsupervised rehabilitation outdoors. These three phases are spread across four different stages: stages 1 and 2 constitute the first rehabilitation phase which aims to improve a patient's independence through bed mobility and a range of functional motion exercises. These exercises allow the patients to be safe ambulators within their home environment. Stage 3 refers to the second rehabilitation phase where an exercise program is provided to a patient by a hospital-based physiotherapist. The prime focus here is to improve lower extremity physical ADLs, particularly ambulation. The activity movements involve aids to increase joints' range of motion and muscle strength. Stage 4 is the last stage of the rehabilitation phase which allows patients to ambulate outside the home environment. This phase helps to boost their confidence, improve their mental health, and re-integrate within their local community. The main movements of interest, as part of the recognition analysis in this paper, are divided into two categories. The first category involves the static and ambulatory activities, which are the static state (activities such as sitting/standing/lying and holding a single position), as well as slow and fast walking (activities that help pay attention to the movement, improve posture, stride, and motion movements). The second category involves hip joint and related muscle strengthening movements, such as leg movement (straightening knees from 90-degree flexion to fully extended and then returning to flexed); lifting thigh upwards (standing with their feet together, arms holding a fixed object for support, then lifting one knee up to the waist level); swinging leg to the side (standing with their feet together, arms holding a fixed object and moving their leg out to the side whilst keeping their knee straight); lying on back (flexing their hip and bringing their knee towards chest at no more than 90 degrees and slowly returning their limb to an extended position); and lying on stomach (flexing their knee and bringing their heel towards their buttocks and returning to the extended position).

Movement Monitoring System Architecture
The proposed architecture for an IoT-enabled wearables rehabilitation movement activity monitoring system is illustrated in Figure 2. The architectural functionalities utilize computational resources at three main levels. These are the wearable wireless sensing level, the IoT gateway (or Internet edge) level, and the Cloud level. Each of these levels plays a significant part in offering the key functionalities for the smooth operation of the overall rehabilitated patient movement monitoring process.
The proposed wearable wireless activity tracker is comprised of 10 DOF MEMS sensor modules (i.e., accelerometer, gyroscope, and magnetometer sensors) responsible for sensing the human movement in real time. Here, the tracker offers four key functionalities, i.e., sensor data acquisition (involving sensor selection, sampling rate, and acquisition duration); data repository (short-term data storage for movement recognition purposes and long-term backup data storage); data processing (involving data calibration and FFT signal processing); and data communication (for the regulation of the data and the message communication pattern). The data acquisition and reporting are configured to suit the dynamics of the application. However, for this research, and based on our previous investigation, only a triaxial accelerometer sensor with an acceleration range of ±2 g has been used [8]. The module also incorporates a real-time clock for capturing a subject's movement event period, a core RF for computational purposes, and an nRF board holding the nrf24Lo1+ transceiver. All the components are depicted in Figure 2 as a wearable tracker components stack. This tracker could be attached anywhere at the upper or lower limb of the human subject. Based on our earlier investigation, it was found that the ankle is the most suitable location for the collection of a post-operative hip fracture patient data [3]. As a result, the activity tracker is attached to the human subject at the ankle location.
The wearable activity tracker wirelessly reports the subject's movement acceleration computed data to a local IoT gateway/edge device through an nRF module that uses its own enhanced ShockBurst communication protocol. The gateway (for example Raspberry Pi, workstation, or smart mobile devices) may handle one or more wearable sensors involved with one or more sensing types. These could be multiple wireless wearable devices used by one user or may deal with multiple users.
For this research, and as depicted in Figure 2, Raspberry Pi combined with nRF radio module was used as an edge device. The gateway offers four key functionalities, i.e., the communication protocol (related to the protocol used and acting as a protocol converter for data transmission and reception); gateway computation (such as FFT signal processing, preliminary recognition knowledge components, and data aggregation); pre-cleaned or a final compressed movement data repository for a short-and long-term movement and processed data storage. However, the data can be managed using the mongo DB and MySQL database, while gateway-Cloud communication for Internet connectivity uses the Wi-Fi TCP-IP protocol.
As a result, both the wearable sensor and the gateway collaboratively offer the role of communicating the data to the Cloud. These could be involved in handling local or edge computation for data compression, decision-making capabilities relevant to offering some level of activity classification, and for data backup storage. In doing so, the involved computation, the data packet size, and the data transaction rate have a direct impact on wearable energy expenditure and communication latency. Managing the scenario of utilizing these resources may have a direct impact on handling the Big Data generated by the process, and hence relieving the Cloud from handling the lower-level details. cleaned or a final compressed movement data repository for a short-and long-term movement and processed data storage. However, the data can be managed using the mongo DB and MySQL database, while gateway-Cloud communication for Internet connectivity uses the Wi-Fi TCP-IP protocol. As a result, both the wearable sensor and the gateway collaboratively offer the role of communicating the data to the Cloud. These could be involved in handling local or edge computation for data compression, decision-making capabilities relevant to offering some level of activity classification, and for data backup storage. In doing so, the involved computation, the data packet size, and the data transaction rate have a direct impact on wearable energy expenditure and communication latency. Managing the scenario of utilizing these resources may have a direct impact on handling the Big Data generated by the process, and hence relieving the Cloud from handling the lower-level details.
At the Cloud level, the ThingSpeak platform has been used in which both the user interaction and higher-level data analyses occur over the span of the rehabilitation process. Both real-time and long-term process data and event monitoring over the overall rehabilitation cycle also take place. The key functionalities occurring at the Cloud level include a gateway device communication HTTP protocol for data transmission from Raspberry Pi (acting as a gateway) to the ThingSpeak Cloud, a Cloud data repository comprised of a health and knowledge data repository. The support of the data available within the Cloud repository is computed using Matlab analytics based on FFT signal processing, machine learning, and artificial intelligence techniques to display the high-level movement information with precision. Moreover, various knowledge components related to the monitoring and personalization of the subject's movement behavior and logically incorrect movement activity classification, rehabilitation progression model event detection, and the creation of various screens for data visualization also occur at the Cloud level. In At the Cloud level, the ThingSpeak platform has been used in which both the user interaction and higher-level data analyses occur over the span of the rehabilitation process. Both real-time and long-term process data and event monitoring over the overall rehabilitation cycle also take place. The key functionalities occurring at the Cloud level include a gateway device communication HTTP protocol for data transmission from Raspberry Pi (acting as a gateway) to the ThingSpeak Cloud, a Cloud data repository comprised of a health and knowledge data repository. The support of the data available within the Cloud repository is computed using Matlab analytics based on FFT signal processing, machine learning, and artificial intelligence techniques to display the high-level movement information with precision. Moreover, various knowledge components related to the monitoring and personalization of the subject's movement behavior and logically incorrect movement activity classification, rehabilitation progression model event detection, and the creation of various screens for data visualization also occur at the Cloud level. In addition to this, ThingSpeak has a built-in Cloud trigger reaction for a follow-up or emergency purpose that can be sent to the required personnel in the form of either a text message, an emergency alarm, or an email. Therefore, the information available in the Cloud could be made available and tailored according to key user interaction with various parties such as the patient, caregiver, physiotherapist, clinician, and nurse-as each of these play their role in contributing towards the improvement and accomplishment of the patient's rehabilitation and recovery goals.

Data Collection and Activity Recognition
The proposed wearable activity tracker, as discussed in the previous section, has been used to collect real-time triaxial accelerometer activity movement data from ten different healthy young individuals (five male and five female subjects in their early twenties) [8]. While these subjects are not the best representatives of real-life hip fracture cases among the elderly, they offer the necessary preliminary trials before stepping towards the healthy elderlies and then the injured elderlies.
The activity tracker is attached at the right ankle joint as it has been considered the most appropriate location in monitoring post-operative hip fracture rehabilitation activities [3]. The wearable activity tracker level involves three preliminary steps for turning the sensed raw data into higher level indicators of the type of activities. These are as follows: 1.
Raw data acquisition and calibration of 518 samples at a sampling rate of 128 sample/second; 2.
FFT processing for identifying the dominant spectrum identification over four seconds of acquisition time; 3.
Finite time movement classification over 4-second window.
As a result, the overall process starts with the subject's activity movement acceleration data collection at a sampling rate of 128 samples/second for 4 s. The reason for choosing a 4 s duration was that it was found to be the minimum time for recognizing a particular activity without any signal distortion or information loss [8]. Therefore, this means that 512 samples of subject's activity movement acceleration data are collected every 4 s.
In order to adhere to the 20 Hz suggested for everyday activities, the collected 512 samples of acceleration data from the three axes are subjected to a basic filtering method. The filtering method involves combining the three entire axes samples to prevent glitches in the activity tracker orientation, taking the mean of the combined axes' samples, eliminating the DC offset, and taking the moving average of every four samples. In doing so, 512 samples of raw data are compressed into 128 pieces of pre-cleaned processed data which will scale down the sampling frequency to 32 Hz with a frequency bin step size of 0.25 Hz. The compressed data are further exclusively subjected to FFT-based signal processing, as proposed by [3]. This identifies the spectrum Cf MA with the maximum acceleration intensity or signal amplitude (MA) that would help in comparing and classifying the activity movements' type [8].
For finding the threshold parameters of each subject when performing any of the individual movements relevant to hip fracture rehabilitation, the data are continuously collected over a time-period of three minutes for each of the activities indicated in Figure 1.
Here, for all activities (i.e., static, slow, and fast walking, leg movement while sitting, swinging leg to a side, lifting thigh upwards, lying on back and lying on stomach), each subject is instructed to continuously perform each individual activity for three minutes. The reason for choosing 3 min is that this offers a minimum of 45 samples of logically complete groups of data. Each of these groups is sufficient for FFT analysis. This will also help us track the dynamic changes for each exercise as the subject transitions from an energetic exercise to steady and then to slowing down. The outcome helps to set a specific threshold range for a particular individual with some level of precision.
From the outcome of the FFT process, the recognition threshold parameters for all the activities are extracted for five male subjects using the approach proposed by [10] which is based on the MA and Cf MA parameters. Subsequently, the threshold feature range of each activity for all five subjects combined together forms an overall male subject range. This is represented in Figures 3 and 4.
Results show that for a static state, the MA is always less than 1 m/s 2 as there is no movement from the subject and the acceleration axis is oriented in a particular direction. For the slow walking activity, male subjects 1, 3, and 5 had an almost similar threshold range in comparison to male subjects 2 and 4, which also have a similar pattern among each other. In the case of a fast walking activity, subjects 3 and 5 have a similar pattern, whereas subjects 1, 2, and 4 are distributed with a slight margin but overlap with each other. These differences are mainly due to the variation among each subject's fitness level and body composition. Another potential reason for these differences could be the variety in the footsteps (shorter or longer steps) taken by subjects while performing such a type of activity.
which is based on the MA and CfMA parameters. Subsequently, the threshold feature range of each activity for all five subjects combined together forms an overall male subject range. This is represented in Figures 3 and 4.
Results show that for a static state, the MA is always less than 1 m/s 2 as there is no movement from the subject and the acceleration axis is oriented in a particular direction. For the slow walking activity, male subjects 1, 3, and 5 had an almost similar threshold range in comparison to male subjects 2 and 4, which also have a similar pattern among each other. In the case of a fast walking activity, subjects 3 and 5 have a similar pattern, whereas subjects 1, 2, and 4 are distributed with a slight margin but overlap with each other. These differences are mainly due to the variation among each subject's fitness level and body composition. Another potential reason for these differences could be the variety in the footsteps (shorter or longer steps) taken by subjects while performing such a type of activity.   the activities are extracted for five male subjects using the approach proposed by [10] which is based on the MA and CfMA parameters. Subsequently, the threshold feature range of each activity for all five subjects combined together forms an overall male subject range. This is represented in Figures 3 and 4.
Results show that for a static state, the MA is always less than 1 m/s 2 as there is no movement from the subject and the acceleration axis is oriented in a particular direction. For the slow walking activity, male subjects 1, 3, and 5 had an almost similar threshold range in comparison to male subjects 2 and 4, which also have a similar pattern among each other. In the case of a fast walking activity, subjects 3 and 5 have a similar pattern, whereas subjects 1, 2, and 4 are distributed with a slight margin but overlap with each other. These differences are mainly due to the variation among each subject's fitness level and body composition. Another potential reason for these differences could be the variety in the footsteps (shorter or longer steps) taken by subjects while performing such a type of activity.   In the case of other activities, i.e., LM, LTU, SLTS, LOB, and LOS, there is a high degree of overlap across the overall range of subjects. However, if we consider the individual subject range, overlap is observed only among some activities. For instance, in the case of male subject 2, LM, SLTS, and LOB overlap with each other and LTU overlaps with LOS. A similar trend is observed where different activities overlap, which varies from subject to subject.
On the other hand, if we take the Cf MA parameter (as can be seen Figure 4) into consideration, the overall subject range similarly has a high degree of overlap with almost all activities-whereas for each individual subject range, some activities overlap partially and others with a high degree. For instance, in the case of the activities of male subject 2, LM, LTU, LOB and LOS overlap with each other to a high degree, but their amplitudes vary, which that makes it easier to classify such types of activities. On the other hand, for male subject 1, only the LTU activity overlaps with LOB.
Therefore, based on the comparative activity data analysis and discussion of five male subjects, it is evident that setting a particular threshold range for all the subjects to recognize an activity is not feasible. This is because the activities parameters overlap with a high degree, and it would be difficult to classify one activity from the other. Herein, personalization can play a crucial role. With personalization, the recognition parameters can be adjusted and specified for a particular subject.
Based on a personalized approach, activities such as static state, slow walking, and fast walking can be easily recognized with high precision as only the amplitude parameter is considered for classification and very marginal overlap is observed due to the nature of the activity behavior. However, for the other hip movement-related activities, both the amplitude and frequency parameters are considered for recognition and have some degree of overlap between them. This overlap could be avoided to some degree, based on the activity transitional rules implemented on the movement history data for the past one minute as described in the following section.
To investigate the significance of personalization over the overall subject range in recognizing a particular activity, the subject was instructed to perform a long-term groupbased activity for a period of 3 min (where each activity is conducted for a period of 1 min) and analyzed considering the different scenarios. A sample example of such scenario is illustrated while considering two cases. These are as follows: Case 1: In case 1, and as presented in Figure 5, the subject was instructed to perform the LTU (1 min), static state (1 min), and swinging leg to a side activities (1 min). This is highlighted in black marker as the activity performed. Results show that based on the personalized approach, as highlighted in purple marker, the LTU activity is 87% accurate, overlapping with LOS by 13%. The static state of a subject is 100% accurate for both personalized and overall subject range as there is no movement from the subject and the axis is oriented in a specific direction. Swinging leg to a side is 74% accurate and an overlap with LM of 26%. In comparison to the overall subject range, which is highlighted with orange marker, it is observed that the LTU activity overlaps with four different activities, i.e., LM, SLTS, LOB, and LOS. However, the same is also observed with the SLTS activity, which overlaps with four different activities, i.e., LTU, SLTS, LOB, and LOS. With the overall subject range approach, it is difficult to discriminate and recognize a particular activity as the degree of overlap is quite high.
Case 2: In case 2, and as presented in Figure 6, the subject was instructed to perform LOB (1 min), static state (1 min), and LOS (1 min). The analysis portrays a 66% recognition accuracy of LOB activity with a 26% overlap with LM, whilst 8% accounts for unrecognized activity. Again, the static state of a subject is 100% accurate. LOS is 87% accurately recognized whilst 13% of the activity is unrecognized, but no overlap is observed with other activities. In comparison to the overall subject range, LOB activity overlaps with four different activities, i.e., LM, SLTS, and LOS. However, LOS overlaps with three different activities, i.e., LTU, SLTS, and LOB. Future Internet 2021, 13, x FOR PEER REVIEW 11 of 19  From the above two cases' analyses, it is evident that personalization is a better approach for the recognition of a subject's activity movement behavior. As a result, it represents the first level of the recognition process that reduces the overlap among the activities in comparison to the overall subject range. The second level of improving the recognition process is based on looking at the logical switching of the activity transition rules and the number of occurrences of a particular activity performed or overlapped. This would help in the correction of any misrecognized activity behavior observed during the past one minute. The overall summary of the findings of case 1 and case 2 is represented in Table  1.
Results show that for case 1, the subject performed the LTU activity 13 times, and overlapped with LOS twice. Since the LOS activity was performed in a lying position compared to LTU, which was performed in standing position, overlapping two times clearly shows that the activity was misrecognized. Therefore, with the possible implementation of this logic, the subject's LTU activity can be corrected and hence recognized with 100% accuracy.  From the above two cases' analyses, it is evident that personalization is a better approach for the recognition of a subject's activity movement behavior. As a result, it represents the first level of the recognition process that reduces the overlap among the activities in comparison to the overall subject range. The second level of improving the recognition process is based on looking at the logical switching of the activity transition rules and the number of occurrences of a particular activity performed or overlapped. This would help in the correction of any misrecognized activity behavior observed during the past one minute. The overall summary of the findings of case 1 and case 2 is represented in Table  1.
Results show that for case 1, the subject performed the LTU activity 13 times, and overlapped with LOS twice. Since the LOS activity was performed in a lying position compared to LTU, which was performed in standing position, overlapping two times clearly shows that the activity was misrecognized. Therefore, with the possible implementation of this logic, the subject's LTU activity can be corrected and hence recognized with 100% accuracy. From the above two cases' analyses, it is evident that personalization is a better approach for the recognition of a subject's activity movement behavior. As a result, it represents the first level of the recognition process that reduces the overlap among the activities in comparison to the overall subject range. The second level of improving the recognition process is based on looking at the logical switching of the activity transition rules and the number of occurrences of a particular activity performed or overlapped. This would help in the correction of any misrecognized activity behavior observed during the past one minute. The overall summary of the findings of case 1 and case 2 is represented in Table 1.
Results show that for case 1, the subject performed the LTU activity 13 times, and overlapped with LOS twice. Since the LOS activity was performed in a lying position compared to LTU, which was performed in standing position, overlapping two times clearly shows that the activity was misrecognized. Therefore, with the possible implementation of this logic, the subject's LTU activity can be corrected and hence recognized with 100% accuracy.
It has also been observed that the swinging leg to a side activity was performed 11 times, and overlapped with the leg movement activity four times. It is evident that the leg movement activity was misrecognized as it was performed in sitting position and quickly switching over to the swinging leg to a side activity performed in standing position is not feasible. Hence, the misrecognition of the swinging leg to a side activity can be corrected. In case 2, the subject performed the LOB activity 11 times, and overlapped with the leg movement activity 4 times. As the LOB activity was performed in lying position, the leg movement activity was misrecognized as the activity was performed in sitting position. Moreover, sudden transition from lying to sitting may result in the capturing of erroneous movement transition data, instead of a particular activity's movement data. Therefore, the LOB activity is recognized with 100% precision.
In another scenario, LOS activity was recognized 13 times whilst the activity was unrecognized twice. As a result, LOS activity was recognized with 100% accuracy. This shows that personalization and looking at the activity movement behavior for the last minute based on logical switching and the occurrences of the activity movement types has considerably improved the recognition accuracy.
The next section discusses the IoT system's performance for possible scenarios of architectural implementations which takes into consideration the available network functions, the information transparency, and wireless sensor lifetime.

IoT System Performance Testing
This section investigates the data communication performance with an emphasis on packet loss analysis. The data stream communication rates of four different time intervals of 1, 2, 3, and 4 s were tested. While 4 s is considered typical for the FFT analysis of the accelerometer data of an elderly user, faster rates are considered to examine the system communication capability for other users. The test has also considered the trade-off of FFT computation performed at the wireless sensor edge against the gateway edge.

Wireless Sensor Edge vs. Gateway Edge Analysis
As part of the investigation, two architectural scenarios are considered. In the first scenario, which is related to the wearable sensor edge, the FFT-based signal processing is embedded within the wireless sensor where only one frame of 16 bytes of data packet size is sent to the gateway once at the four different time intervals chosen. These are intervals of 1, 2, 3, and 4 s, respectively. However, in the second scenario, the FFT computation is embedded at the gateway edge while the wireless sensors simply perform the acquisition and calibration of the data samples. Here, the fine tuning of the raw activity movement signals through basic filtering methods such as removing the DC offset and taking average of every fourth sample [3] is performed at the wearable wireless sensor edge. In doing so, a single frame has a data packet size of 12 bytes and 128 such readings are sent to the gateway again at four different time intervals where the FFT-based signal processing is performed at the gateway level. The experimental description of each of these scenarios and their effect on the packet loss analysis are as follows: Experiment 1: The first experiment investigates the effect of increasing the number of data gathering nodes on the data drop rate while transmitting the data at different time intervals. Here, we used a network of up to five nodes feeding the gateway with a fixed rate of sensors' data. Five different network setups have been considered where each wearable node is static and transmitting the data packet based on first and second scenario as discussed above. The Carrier Sense Multiple Access (CSMA) MAC protocol is used, where all the nodes simultaneously report the coordinator attached to the gateway (Raspberry Pi). The experiment is repeated five times and each experiment is performed for a time duration of fifteen minutes. Each time, one more node is added to feed the data to the gateway. All the five sensors are stationary and are placed on the same bench without being obstructed by any obstacles around and between the nodes. At the wearable sensor edge level, no packet loss was observed for all the nodes in the network. However, at the gateway edge level and as represented in Figure 7, no packet loss is observed for one node network and is almost negligible, i.e., 1%. Taking two node networks as an example, the average packet loss for a 1 s time interval is around 37% and subsequently decreases to 3, 3, and 2%, respectively, as the time interval rate increases. However, a similar trend is also observed for the other three node networks. Therefore, especially in case of bulk data transmission, it is clearly indicated that as the number of nodes in the network increases, the percentage of packet loss increases exponentially. These also decrease as the time interval rate increases, as this provides enough time for the data transmission to occur successfully. performed at the gateway level. The experimental description of each of these scenarios and their effect on the packet loss analysis are as follows: Experiment 1: The first experiment investigates the effect of increasing the number of data gathering nodes on the data drop rate while transmitting the data at different time intervals. Here, we used a network of up to five nodes feeding the gateway with a fixed rate of sensors' data. Five different network setups have been considered where each wearable node is static and transmitting the data packet based on first and second scenario as discussed above. The Carrier Sense Multiple Access (CSMA) MAC protocol is used, where all the nodes simultaneously report the coordinator attached to the gateway (Raspberry Pi). The experiment is repeated five times and each experiment is performed for a time duration of fifteen minutes. Each time, one more node is added to feed the data to the gateway. All the five sensors are stationary and are placed on the same bench without being obstructed by any obstacles around and between the nodes. At the wearable sensor edge level, no packet loss was observed for all the nodes in the network. However, at the gateway edge level and as represented in Figure 7, no packet loss is observed for one node network and is almost negligible, i.e., 1%. Taking two node networks as an example, the average packet loss for a 1 s time interval is around 37% and subsequently decreases to 3, 3, and 2%, respectively, as the time interval rate increases. However, a similar trend is also observed for the other three node networks. Therefore, especially in case of bulk data transmission, it is clearly indicated that as the number of nodes in the network increases, the percentage of packet loss increases exponentially. These also decrease as the time interval rate increases, as this provides enough time for the data transmission to occur successfully.

Experiment 2:
In the second experiment, all five nodes are active and attached to the human subject at five different body locations (hip, thigh, ankle, waist, and chest), during a slow walking activity movement. Figure 8 represents the wearable edge and gateway edge packet loss comparative analysis when all the nodes are active and transmitting data to the coordinator. From the analysis, it can be seen that an average packet loss of 1% has been observed when FFT-based computation is performed at the wearable sensor level. In contrast, at the gateway edge level, the packet loss is quite high, i.e., 74% when the data

Experiment 2:
In the second experiment, all five nodes are active and attached to the human subject at five different body locations (hip, thigh, ankle, waist, and chest), during a slow walking activity movement. Figure 8 represents the wearable edge and gateway edge packet loss comparative analysis when all the nodes are active and transmitting data to the coordinator. From the analysis, it can be seen that an average packet loss of 1% has been observed when FFT-based computation is performed at the wearable sensor level. In contrast, at the gateway edge level, the packet loss is quite high, i.e., 74% when the data transmission rate is 1 s. However, as the time interval rate increases to 2, 3, and 4 s, the percentage packet loss % also reduces to 70, 67, and 62%, respectively. process. On the other hand, at gateway edge level, data are not completely compressed and require 128 communication transactions with a data packet size of 12 bytes to be transmitted. Therefore, all the 128 readings are required to be received by the gateway for the FFT process to be accurate. Missing one or more readings out of the 128 would affect the FFT process and hence end up discarding a complete set of data collected at the specified interval. As a result of such losses, an increase in the percentage of packet loss was observed for all the nodes and across all the networks at the gateway edge level. Figure 8. Average packet loss when acquired data are processed and compressed at the wearable edge or gateway edge for an active five-node network. Processing at the wearable sensor age offers significant improvement in terms of system performance.
Considering the radio packet transmission and computational processing occurring at the wearable and gateway edge levels, analyzing the wearable device energy consumption and how long it would last at four different time intervals chosen in the packet loss analysis is essential. Since the Microduino modules can run on 3.3 V, the wearable device is powered with a ½ AA rechargeable battery of 1000 mAh at 3.7 V with a cut-off voltage of 2.75 V. The battery selection is random in order to cover a day. Figure 9 represents the wearable and gateway edge energy consumption at four different time intervals, i.e., 1, 2, 3, and 4 s. The results show that at the wearable edge level, the current consumption for all time intervals ranges from 20 to 24 mA. However, at the gateway edge level, it ranges from 25 to 30 mA. Therefore, the gateway edge current consumption is higher compared to the wearable edge because 128 communication transactions with a data packet size of 12 bytes are continually transmitted. Figure 8. Average packet loss when acquired data are processed and compressed at the wearable edge or gateway edge for an active five-node network. Processing at the wearable sensor age offers significant improvement in terms of system performance.
In summary, the main reason for no or minimal packet loss at the wearable sensor edge level is because the final data are compressed into one communication transaction of 16 bytes which does not overload the communication system during the transmission process. On the other hand, at gateway edge level, data are not completely compressed and require 128 communication transactions with a data packet size of 12 bytes to be transmitted. Therefore, all the 128 readings are required to be received by the gateway for the FFT process to be accurate. Missing one or more readings out of the 128 would affect the FFT process and hence end up discarding a complete set of data collected at the specified interval. As a result of such losses, an increase in the percentage of packet loss was observed for all the nodes and across all the networks at the gateway edge level.
Considering the radio packet transmission and computational processing occurring at the wearable and gateway edge levels, analyzing the wearable device energy consumption and how long it would last at four different time intervals chosen in the packet loss analysis is essential. Since the Microduino modules can run on 3.3 V, the wearable device is powered with a 1 /2 AA rechargeable battery of 1000 mAh at 3.7 V with a cut-off voltage of 2.75 V. The battery selection is random in order to cover a day. Figure 9 represents the wearable and gateway edge energy consumption at four different time intervals, i.e., 1, 2, 3, and 4 s. The results show that at the wearable edge level, the current consumption for all time intervals ranges from 20 to 24 mA. However, at the gateway edge level, it ranges from 25 to 30 mA. Therefore, the gateway edge current consumption is higher compared to the wearable edge because 128 communication transactions with a data packet size of 12 bytes are continually transmitted. Future Internet 2021, 13, x FOR PEER REVIEW 15 of 19 Figure 9. Analysis of sensor wearable energy consumption when processing is taking place at the sensor wearable and gateway edge. Marginal difference in energy consumption due to the available redundancy in the commercial device used.

Long-Term Data Presentation and Cloud Role
This section presents the long-term data presentation of different activity movements performed by a young healthy subject during the day at the Cloud level. The subject placed the wearable device on his ankle for the whole day and was instructed to perform the post-operative hip fracture rehabilitation activities. This was the preliminary step in relating the subject activity movement recognition with the rehabilitation model discussed in Section 3.
The activity movement recognition data collected at the Cloud level were then analyzed and presented. Figure 10 presents the sample representation of the real-time activity movement recognition performed by a subject during a day. According to our proposed approach, each activity is recognized every 4 s. Therefore, the data visualization presented depicts the different types of rehabilitation activity movement performed by the subject. For instance, the subject was in static state three times, whilst the subject performed the leg movement activity twice.

Long-Term Data Presentation and Cloud Role
This section presents the long-term data presentation of different activity movements performed by a young healthy subject during the day at the Cloud level. The subject placed the wearable device on his ankle for the whole day and was instructed to perform the post-operative hip fracture rehabilitation activities. This was the preliminary step in relating the subject activity movement recognition with the rehabilitation model discussed in Section 3.
The activity movement recognition data collected at the Cloud level were then analyzed and presented. Figure 10 presents the sample representation of the real-time activity movement recognition performed by a subject during a day. According to our proposed approach, each activity is recognized every 4 s. Therefore, the data visualization presented depicts the different types of rehabilitation activity movement performed by the subject. For instance, the subject was in static state three times, whilst the subject performed the leg movement activity twice.  Figure 9. Analysis of sensor wearable energy consumption when processing is taking place at the sensor wearable and gateway edge. Marginal difference in energy consumption due to the available redundancy in the commercial device used.

Long-Term Data Presentation and Cloud Role
This section presents the long-term data presentation of different activity movements performed by a young healthy subject during the day at the Cloud level. The subject placed the wearable device on his ankle for the whole day and was instructed to perform the post-operative hip fracture rehabilitation activities. This was the preliminary step in relating the subject activity movement recognition with the rehabilitation model discussed in Section 3.
The activity movement recognition data collected at the Cloud level were then analyzed and presented. Figure 10 presents the sample representation of the real-time activity movement recognition performed by a subject during a day. According to our proposed approach, each activity is recognized every 4 s. Therefore, the data visualization presented depicts the different types of rehabilitation activity movement performed by the subject. For instance, the subject was in static state three times, whilst the subject performed the leg movement activity twice.  In support of the sample representation, an overall summary representation of the daily frequency practice of the activity performed by a subject during the day is presented in Figure 11. The numbers related to daily frequency practice refers to the number of each repetition performed every 4 s by a patient for a particular activity. For instance, the patient was doing slow walking activity 10 times of 4 s recognition.
Results show that the subject was static most of the time. The ambulatory movements, namely slow and fast walking, were performed 9 and 10 times, respectively. Hip fracturerelated activities such as LM, LM, LTU, SLTS, LOB, and LOS were performed 6, 4, 5, 15, and 13 times, respectively. UA refers to the unrecognized activity and 10 times the activity was unrecognized. This is because the patient might be performing other ADLs as part of their daily routine and not related to the rehabilitation activity movements or some of the activity movements overlapping with each other. This type of information is useful for the physiotherapist and medical professionals to observe how the patient is performing on an hourly, daily, weekly, or monthly basis depending on one's requirements. Moreover, such information is of great significance for mapping with the proposed rehabilitation model. This would help in determining the stage at which the patient is at and their progression level so that a follow up can be performed when required and in case of an emergency. Since this was a preliminary step in portraying the overall summary of the patient activity movement behavior, further research is required to investigate how often (hourly, daily, weekly, or monthly) the physiotherapist or medical professionals prefer the subject's activity movement behavior information to be presented. Secondly, we must investigate the rules to be set while relating the subject's activity movement behavior with the proposed model. Thirdly, we must identify the key performance indicators for the patient mobility improvements and associate the key measurements required. This could help the overall process to be automated and aid the patient and medical professionals take the necessarily follow-up actions for progressing the healing process.
Future Internet 2021, 13, x FOR PEER REVIEW 16 In support of the sample representation, an overall summary representation of daily frequency practice of the activity performed by a subject during the day is presen in Figure 11. The numbers related to daily frequency practice refers to the number of e repetition performed every 4 s by a patient for a particular activity. For instance, the tient was doing slow walking activity 10 times of 4 s recognition.
Results show that the subject was static most of the time. The ambulatory mo ments, namely slow and fast walking, were performed 9 and 10 times, respectively. H fracture-related activities such as LM, LM, LTU, SLTS, LOB, and LOS were performe 4, 5, 15, and 13 times, respectively. UA refers to the unrecognized activity and 10 times activity was unrecognized. This is because the patient might be performing other AD as part of their daily routine and not related to the rehabilitation activity movement some of the activity movements overlapping with each other. This type of informatio useful for the physiotherapist and medical professionals to observe how the patien performing on an hourly, daily, weekly, or monthly basis depending on one's requ ments. Moreover, such information is of great significance for mapping with the propo rehabilitation model. This would help in determining the stage at which the patient i and their progression level so that a follow up can be performed when required and case of an emergency. Since this was a preliminary step in portraying the overall summ of the patient activity movement behavior, further research is required to investigate h often (hourly, daily, weekly, or monthly) the physiotherapist or medical professionals p fer the subject's activity movement behavior information to be presented. Secondly, must investigate the rules to be set while relating the subject's activity movement behav with the proposed model. Thirdly, we must identify the key performance indicators the patient mobility improvements and associate the key measurements required. T could help the overall process to be automated and aid the patient and medical pro sionals take the necessarily follow-up actions for progressing the healing process. Figure 11. Overall summary sample of the daily frequency practice of the activity movement performed by a young healthy sub While the above work has clarified a number of design challenges, future works m involve the following areas: Figure 11. Overall summary sample of the daily frequency practice of the activity movement performed by a young healthy subject.