Remote Monitoring Model for the Preoperative Prehabilitation Program of Patients Requiring Abdominal Surgery

: Physical ﬁtness and level of activity are considered important factors for patients with cancer undergoing major abdominal surgery. Cancer patients with low ﬁtness capacity are at greater risk of postoperative complications, longer hospital stays, and mortality. One of the main challenges facing both healthcare providers and patients is to improve the patient’s physical ﬁtness within the available short period (four to six weeks) prior to surgery. Supervised and unsupervised physical prehabilitation programs are the most common recommended methods for enhancing postoperative outcomes in patients undergoing abdominal surgery. Due to obstacles such as geographical isolation, many patients have limited access to medical centers and facilities that provide onsite prehabilitation programs. This article presents a review of the literature and the development of a model that can remotely monitor physical activities during the prehabilitation period. The mixed prehabilitation model includes the identiﬁcation of fundamental parameters of physical activities (type, intensity, frequency, and duration) over time. A mathematical model has been developed to offer a solution for both the healthcare provider and patients. This offers the opportunity for physicians or physiotherapists to monitor patients performing their prescribed physical exercises in real time. The model that has been developed is embedded within the internet of things (IoT) system, which calculates the daily and weekly efforts made by the patients and automatically stores this in a comma-separated values (CSV) ﬁle that medical staff can access. In addition, this model allows the patient to compensate for missed prescribed activity by adding additional efforts to meet the prehabilitation requirements. As a result, healthcare staff are provided with feedback on patient engagement in prescribed exercise during the period of the prehabilitation program.


Introduction
High complication rates following abdominal cancer surgery render many patients unable to perform a number of activities of daily living (ADL) that they were able to undertake before surgery [1]. Prehabilitation provides an opportunity to address physiological impairments preoperatively, improve quality of life, and attenuate patient-related barriers such as anxiety following surgery. It is an intervention that aims to increase a patient's preoperative physiological reserve to improve postoperative outcomes [2]. There is often limited time between the cancer diagnosis and the scheduled operation, with a window of four to six weeks between chemotherapy and surgery available for prehabilitation. Typically, these cancer patients undergo a strict prehabilitation program to improve their aerobic fitness and muscular performance before the operation.
Traditional models of prehabilitation focus on multiple supervised exercise sessions in hospital or clinical settings. These programs last for approximately four to six weeks and the frequency, duration, and intensity of the prescribed prehabilitation activities is determined by the doctors and physiotherapists overseeing the program. In a supervised program, the patient must visit the hospital or physiotherapy center at least two to four times a week and complete supervised exercise sessions lasting between 35 to 50 min [3][4][5]. In traditional models of prehabilitation, patient progression is directly recorded by the medical staff managing the program. The main advantage of this model is that the medical staff can be assured that the patient has performed the prescribed physical activities at the required intensity during the prehabilitation program, provided they are compliant [4,6,7]. In contrast, the main disadvantages of this traditional model are that it is demanding on resources (e.g., physical facilities (hospitals and clinics), equipment, and qualified instructors) and limited to those patients who have geographical access to these resources.
Another approach to prehabilitation is an unsupervised community model. In an unsupervised community-based model of prehabilitation, patients can perform physical activities in a variety of local community settings, including the home, gymnasium, and outdoors [8,9]. A community-based program also allows time flexibility to perform the physical activities. Home-based programs are significantly cheaper to run than hospital programs because of reduced demand on resources (e.g., facilities, staff, transport) and the limited need for travel. However, this type of program is usually unsupervised and medical staff cannot guarantee that the patient performs the prescribed physical exercise at an appropriate intensity.
In recent times, the Coronavirus (Covid- 19) pandemic disease has forced a number of hospitals and clinics to adopt the unsupervised community model for prehabilitation because of the limitations to physical access to clinics and the diversion of healthcare staff and resources to address the pandemic [10]. Evidence clearly indicates that compliance to unsupervised prehabilitation programs is considerably less than hospital-based programs [11]. Another approach for addressing resourcing and geographical isolation is to develop a mixed prehabilitation model via remote monitoring that includes supervised and unsupervised components of prehabilitation. A mixed, home-based, virtual prehabilitation program that could be delivered through a cyber physical system has the potential to minimize these effects [11]. Such a system could enable cancer patients to perform prescribed physical activities without visiting the hospital or physiotherapy center while healthcare staff can monitor patient progress remotely. Thus, a mixed model has the potential to reduce the impact on the healthcare system whist providing cancer patients the opportunity to partake in prehabilitation under remote monitoring and supervision. This paper builds on our previous work [12], which developed a 3D accelerometer sensor system that recognized different types and intensities of physical activities. It attempts to formulate a knowledge structure on the physical activities typically prescribed to abdominal cancer patients during the prehabilitation period. Furthermore, this study is trying to support the ability of a single 3D accelerometer sensor system to identify and quantify patient physical activities through logical analysis of movement behavior over time.
Accordingly, this work describes a novel mathematical mixed prehabilitation model that offers the necessary monitoring and follow up to execute an effective prehabilitation program. Accelerometry data from fourteen participants aged from 50 to 83 years is used to describe processes within the model. The model could potentially be part of the patient's movement monitoring system and provide the necessary warnings and recommendations for successfully reaching the targeted prehabilitation goals. The model identifies the type, frequency, and duration of activities cancer patients are engaging in throughout the prehabilitation period. Furthermore, the model also involves the detection of the physical effort (intensity) of participants as they partake in prehabilitation and recreational activities. The output of the model will be in the form of accumulated credit points based on the type, intensity, duration, and frequency of activity. In contrast, hospitalization is considered to be sedentary behavior (e.g., sitting, bed rest) and is considered as a negative factor that will lead to a reduction in points [13,14]. Thresholds for positive physiological adaptions are integrated into the model [15,16].

Current Prehabilitation Programs
Section two describes the key preoperative prehabilitation program parameters. It also details the key outcome measures used to assess the efficacy of prehabilitation programs and the negative impact of sedentary behavior and bed rest.

Key Outcome Measures Used to Assess the Efficacy of Prehabilitation
A key component of any model is to determine key outcome measures that can be used to assess the efficacy of a prehabilitation program. One of the primary aims of a prehabilitation program for presurgical cancer patients is to reduce the number of postoperative complications, length of hospital stay, and mortality [1,16]. These factors are often measured as number of days in hospital (intensive care unit, total length of stay, and readmission rate) and morbidity, which is often classified using the Clavien-Dindo classification score [11,16]. Postoperative complications can extend hospital stay periods, increase readmissions, elevate health costs, affect patient function and quality of life, and increase risk of mortality.
A major factor that has been shown to influence postoperative outcomes is preoperative fitness and physical condition, with those patients with low physiological reserve (aerobic fitness) being at high risk of postoperative complications and mortality [16,17]. Aerobic fitness is often quantified via cardiopulmonary exercise testing (CPET) using measures of anaerobic threshold (AT) and peak oxygen consumption (VO2 peak) [16]. Patients with a low AT (<9-10 mL·kg −1 ·min −1 ) and a low VO2 peak (<15 mL·kg −1 ·min −1 ) have been identified as being at greater risk of postoperative complications [11,16]. Another outcome measure that has been used to assess physical fitness is the six-minute walk test (6MWT). The advantage of physical fitness measures is that they can be measured before and at the end of prehabilitation programs, and prior to surgery. These measures provide important information on gains in physical fitness prior to surgery, as well as providing data for risk stratification and the level of care required following surgery.

Prehabilitation Program Parameters
Prehabilitation programs are designed to improve aerobic fitness and reduce postoperative complications. To achieve this, key exercise parameters were developed. These include the mode, intensity, frequency, duration, and volume of exercise. It is important for a healthcare system to identify and monitor these key exercise parameters to ensure the patient is working at a level of physical activity that will improve physical fitness and reduced perioperative risk. Identifying and logging these parameters can be done through the application of simple wearable technology.
Identification of the type of activity the patient is engaging in can provide the therapist with information about exercise modality preferences within clinical and community settings. Aerobic exercise is the most common type of exercise used in cancer prehabilitation programs. Common modalities used in supervised prehabilitation programs include rowing machines, cycle ergometers, treadmill walking, running, and cross training machines [4,5,18,19]. Unsupervised programs tend to be restricted to modes of exercise that are most readily available in the community and include walking, running, and cycling [8,9]. Different modes of exercise can be identified by using Fast Fourier Transformation (FFT) amplitude and frequency measures of data attained from 3D accelerometers during the activity [12] (Table 1). For example, cycling produces frequency and amplitude values that differ from rowing. This makes it relatively easy to distinguish between the two modalities.
A major exercise parameter that has been shown to influence physical fitness and postoperative outcomes in cancer patients is exercise intensity. In prehabilitation programs, exercise intensity is typically describe as "low", "moderate", or "high" and is often quantified as a percentage of maximal heart rate or perceived effort using Borg's ratings of perceived exertion (RPE). A number of researchers recommend that elderly people perform physical exercise at moderate to vigorous intensities rather than at a light intensity [15,20,21]. In addition, it is important to train at moderate exercise intensity because this level of activity is associated with greater health benefits and lower mortality risk than low intensity [22]. Most cancer prehabilitation studies have exercised patients at moderate to vigorous exercise intensity, as this has been shown to lead to greater improvements in aerobic fitness when compared to low intensity exercise [15,20,21].
In most supervised prehabilitation programs, exercise intensity is quantified using heart rate measures. For example, Heldens et al. [4] exercised their patients at 60% of maximal heart rate (moderate intensity), whereas Dronkers and Karin used exercise intensities that were classified as moderate to vigorous (60-85% of maximal heart rate) [5,19]. Intensity measures in non-supervised programs are more varied (Table 1). Gillis et al. [8] used both heart rate and RPE measures to quantify aerobic exercise intensity in 38 cancer patients of different ages partaking in a non-supervised prehabilitation program. The exercise intensity initially started at 40% of heart rate reserve (low intensity) and gradually increased once the participant was able to complete 20 min of continuous aerobic activity. Sekine et al. [9] recruited 22 cancer patients who were scheduled for surgery. In this study, the patients were not given specific intensity measures but were instructed to walk more than five thousand steps each day. More recently, prehabilitation programs have used high intensity interval training (HIIT). HIIT involves a series of short high intensity bouts of exercise (15 s to 4 min duration) followed by a low intensity or rest period. The advantages of this type of training are that patients are able to sustain high intensity workloads over short time periods in the initial stages of prehabilitation, and a similar volume of exercise can be achieved in a much shorter duration of time when compared to continuous exercise at a moderate intensity. HIIT has also been shown to achieve similar or greater improvement in aerobic fitness when compared to moderate intensity continuous training [23].
Heart rate monitoring is relatively easy to use as a measure of intensity when exercise is performed under the supervision of a quality health professional. However, the use of heart rate measures in the community is more difficult due to the complexity of attaching heart rate monitors, administration of heart rate altering drugs, and the difficulties associated with downloading heart rate data. It is also difficult to determine the type of activity being performed when using heart rate and RPE measures. A more recent approach used to detect the intensity of a specific type of activity is 3D accelerometry. Different activities at a particular intensity will produce specific amplitude and frequency measures. For example, for older people, walking at a low intensity (3.5 kph) will produce lower frequency and amplitude measures than walking at a high intensity (4.5 kph) [12].
The frequency and duration of prehabilitation exercise interventions are also important parameters that need to be monitored. Most supervised and unsupervised prehabilitation programs require patients to exercise for a minimum duration of 20-30 min two to seven times per week. For example, Karin et al. [5] involved 115 participants under the supervision of physiotherapist for six weeks. Exercise was undertaken on a cross trainer, rowing machine, and stationary bike for a duration of 20-30 min five times per week at a moderate to vigorous intensity. Bousquet et al. [18] investigated the postoperative effect of a supervised prehabilitation exercise program on 41 colorectal cancer patients. The exercise prescription was personalized to each participant's fitness level. Participants were prescribed 30 min of moderate intensity aerobic activity consisting of either walking, cycling, or jogging three to four days per week. McLellan et al. [15] suggests that exercise bout duration should at least be 10 min to have a significant physiological effect. Multiple 10-15 min bouts of exercise at a moderate to vigorous intensity have been shown to be as effective as 30 min of continuous moderate intensity exercise for improving aerobic fitness in deconditioned individuals [15,22]. A prehabilitation model IOT system must be designed to identify and detect these short bouts of physical activity. Furthermore, sample rates of accelerometers must be high enough to detect the repetitive short burst of high intensity activity followed by low activity or rest that occurs during HIIT. Our previous research showed that 3D accelerometer FFT analysis had the potential to accurately identify type and intensity of exercise over relatively short periods of time [12]. The volume of exercise provides the clinician with an indication of total amount (volume) of exercise or energy expenditure and is a product of the intensity, duration, and frequency. It has been shown that exercising at a vigorous intensity for 20 min three times per week produces a similar volume of exercise to exercising at moderate intensity for 30 min five times per week. The minimal volume of exercise required to improve preand postsurgical outcome measures in abdominal cancer patients has not been clearly established. However, Weggemans et al. [20] found convincing evidence that a higher volume of physical activity provided greater health benefits than low volume physical activity in those individuals who were relatively inactive. In traditional prehabilitation programs, volume is initially increased by increasing frequency and duration of activity, whereas as in the mid to late stages of prehabilitation, volume is primarily influenced by increasing the intensity of exercise [4,5].
Whilst all prehabilitation programs involve aerobic training, a number of supervised and unsupervised programs also include resistance training directed at improving muscle strength and size. Supervised resistance training prehabilitation includes gym exercises such as leg press and seated row, whereas non-supervised programs tend to use more functional lower limb resistance training and TheraBand exercises (Table 1).

Incidental Exercise and Inactivity
Detecting specific prescribed physical activity is an essential component of any remote monitoring prehabilitation system. However, the detection and analysis of incidental activity and inactivity provides a more precise view of activity levels during the prehabilitation period.
Incidental activity is any physical activity performed outside the prescribed prehabilitation program. The most common way of measuring incidental activity in oncology is through detecting step count [24]. Our model was designed for tracking different types of physical activity. Tracking steps in our model translates as a walking activity at different intensities.
A key factor that has a negative influence on prehabilitation outcomes is inactivity. Most inactivity studies have used the bed rest model. Short-term bed rest (five days) in older adults is characterized by a significant loss in lean mass and strength, posing significant health consequences [25]. Floreani et al. [14] found that 14 days of bed rest in elderly adults significantly reduced muscular mechanical work and efficiency during walking and reduced VO2max by 12%. The study also found that elderly people needed at least three 65-min physical rehabilitation sessions per week over a period of two weeks to return to the same fitness level prior to bed rest [14]. Other studies have also found in older healthy adults that 10 days of bed rest has detrimental effects on muscular strength, walking distance and speed, functional parameters, and aerobic fitness [13]. Table 2 shows a summary of changes in physical fitness of the elderly after a period of bed rest [13,14,26]. The remote monitoring prehabilitation system discussed in this paper can identify periods of inactivity by analyzing accelerometry data that is transmitted to the cloud. Real-time transfer of data to the cloud is advantageous to the healthcare staff and enables them to respond swiftly to a system alert. Our model also has the ability to detect accumulation of inactivity over longer periods, and this data is stored in the patient database to use for the credit calculation, as explained in Section .

Threshold Time and Intensities
An important part of any model is detecting minimal duration and intensity thresholds required to improve fitness levels. Though no clear guidelines have been established [27,28] literature indicates that moderate to vigorous exercise intensity is required for improvement in aerobic fitness in the elderly [15,20,21].
The minimal bout duration required to have positive effects on aerobic fitness and health parameters is also important [29]. A minimal duration of 10 min of moderate to vigorous exercise has been suggested as a threshold [15]. However, evidence would indicate that this short duration exercise should be performed at least twice per day to gain improvements in aerobic capacity [15,22].

Development of a Mixed Prehabilitation Program Model
According to the previous Sections 2.1-2.4 the length of a prehabilitation program for cancer patients is typically four to six weeks [5,8]. Physical activities are the main component of the prehabilitation program. A clinician can prescribe the patient one or more of the nine physical activities (walking, running, cycling, treadmill, cross-trainer, step up, leg press, rowing, and staircase ascending/descending) that are most commonly used in prehabilitation programs [4,5,8,9]. The prescribed exercise intensity, duration, and frequency varies across the documented studies [18,19]. The total weekly thresholds should be at least two 10 min sessions per day that equate to a total of 150 min at a moderate intensity or 75 min at a vigorous intensity, or a combination vigorous and moderate intensity that equates to a similar volume of exercise [8,18,30,31]. These target threshold values may be adjusted based on the initial program parameters prescribed by the clinician. Bed rest or prolonged periods of inactivity are considered to have negative impacts on the prehabilitation program [13,14,26]. Table 2 shows prehabilitation physical exercise parameters and their boundaries. Table 2. Key prehabilitation elements, boundaries, and rules for the model.

Prehabilitation Elements Prehabilitation Boundaries Remarks
Time frame of prehabilitation program Four weeks or six weeks May be less or more based on the patient status and surgery scheduled.

Number of sessions per week Minimum two sessions
The patient could perform any number of sessions according to the health supervisor guidance.
Threshold time of physical activity per week 150 min moderate intensity or equivalent 75 min of vigorous intensity is considered equal to 150 min moderate intensity [30,31].
Minimum time of each session 10 min or more at a moderate intensity 5 min of vigorous is equal to 10 min of moderate and approximately 15 min of light intensity [28,29].

Physical exercise types
Walking, running, cross trainer, rowing, treadmill, step up, leg press, cycling, staircase ascending/descending This could be any pair or more of these nine activities, and is based on the physician's and physiotherapist's recommendations.
Location of the prehabilitation program Indoor, GYM, outdoor According to the availability of physical resources and the patient status.

Negative impact Bed rest
Each day of bed rest will produce negative credit and eliminate the effort of one day of recommended physical activity [14,25].

Mathematical Formula of the Mixed Prehabilitation Program
The main objective of developing a mathematical model is to track and provide feedback on patient activities during the prehabilitation program. The unique feature of this model is the real-time feedback on the specific prehabilitation activities undertaken by the patient and the quantification of exercise intensity and duration. This may be made available to the various parties of interest through the cloud-based system. In addition, the prehabilitation mathematical formulas described in this paper were developed from the various research findings that were discussed in previous sections. Table 2 shows a summary of these features.
Prescribed physical activity can be performed on any number of days during the week and all the physical efforts will be accumulated as a credit gain. One credit point will equate to the completion of a physical activity performed at the prescribed duration and intensity on any given day. Any further efforts beyond the prescribe exercises will be logged as additional credit points. Theoretically, the system continues calculating and accumulating the credit gain for patients performing more exercise than originally prescribed by the clinician. In this model, two points are the maximum number of credits gained per day, which is equivalent to approximately 60 min of moderate exercise based on Equation (1) below. where: P is the credit gained for the prehabilitation program independent of the total program duration. Common prehabilitation programs have a length of four or six weeks. In this study, we used a six-week prehabilitation program that is represented as P b . A four-week prehabilitation program is represented by the symbol P a . I indicates the exercise intensity level. Here 0.75 is allocated for light intensity, 1 for moderate intensity, and 2 for vigorous intensity. The weighting of the different intensities is based the relative effect of each intensity on improvements in health and fitness [20,22,28,29] described in Section 2.4. T is the minimum threshold time. This threshold is 10 min of physical activity at a moderate or vigorous intensity [15]. D e is the duration of exercise, which is proportional to the standard unit time T. Currently, the system considers and calculates each effort done by the patient regardless of meeting threshold time target (10 min at moderate intensity). This is because it is still unclear whether very short bursts exercise (less than 10 min) at a moderate or vigorous intensity should be discarded or not. W e represents the modality or type of prescribed physical exercise. At this stage of the model, all nine types of exercise are initially given the same value. The value for type of exercise is based on previous studies [8,18,30,31] where the patient must perform 150 min of moderate intensity exercise (e.g., 30 min of moderate physical activity five times per week) or equivalent per week, for a period of six weeks. In this example, the total volume of exercise over the six weeks (P) equates to a total of 30 credit points. Future work may differentiate among activities when it comes to weight assignment. The total credits of each program can be varied based on the program length, prescribed physical exercises, and the duration and frequency of each exercise per week.
As mentioned previously, the six-week prehabilitation program P b was selected as a case for the implementation of the mathematical formula. The program duration is six weeks (42 days), and the duration of total physical activity suggested here is equivalent to 150 min of moderate intensity exercise per week. Theoretically, a 30-min physical exercise session at a moderate intensity equates to 1 credit point, as per Equation (1). Therefore, the patient must accumulate 30 credit points at the end of the prehabilitation program (5 points per week for six weeks). The target of 30 credit points provides the patient with a measurable goal and gives the therapist an indication of the volume of exercise accumulated throughout the prehabilitation program. The patient can gain more than the targeted value if he or she is engaged in more physical activity than prescribed. In contrast, periods of bed rest reduce the number of prehabilitation credit points. The previous example represents an ideal case. In reality, the time of physical activity per week, exercise duration, and intensity may vary between patients based on the clinician's recommendations.
The weekly accumulated credit is defined by Equation (2), shown below.
where C wb is the accumulated prehabilitation credits per week. Accordingly, each day has an index which is represented by n = 1, 2 . . . 7. The total accumulated credit is defined by Equations (3) and (4), shown below. where: C T is the total accumulated credits for the six weeks without considering bed rest. G is the total accumulated credits with bed rest.
Calculations for R b (bed rest or hospitalization) are done by identifying the consecutive days where no activity is detected. R b is a constant value of -1 and n is the number days of bed rest or hospitalization, while k is the maximum number of allowable bed rest days during the prehabilitation program. It has been suggested that the 14 days of bed rest is sufficient to eliminate the targeted total credits gained during a six-week prehabilitation program. If this is the case, the patient will need an extended period of prehabilitation to return to the same level of fitness prior to bed rest [14].

Implementation of the Mixed Prehabilitation Model
As explained in previous sections, a specific physical activity and corresponding intensity can be detected from dominant frequency and amplitude values calculated from accelerometer data. Data relevant to the nine activities of interest are published in our previous work [12] and are shown in Table 3.
Each type of activity is presented with "crisp" values of frequency and intensity. Practically, these crisp values represent the center of gravity of the particular activity. In reality, there is a "fuzzy span" around the center values for each movement. Different movements have some form of overlap among each other. This overlap leads to some activities not being recognized, and this may result in the loss of some credited efforts. Special logical approaches have been explored to enhance the activity recognition and credited physical effort calculations. In an attempt to reduce the impact of overlaps of power spectrum frequency and amplitude measures among the recognized activities, the extracted recognized activities are examined by three simple logical methods based on short-term history data. Table 3. Results of frequency analysis of 3D accelerometer data for nine different types of activity at three different intensities collected from a sensor placed on the ankle of five participants (modified from Al Naime et al. [12]).  Figure 1 shows a flow chart of the three methods of data recognition and processing. As discussed in the previous work [12], filtered x, y, and z accelerometer data is transmitted from a sensor placed on the patient's ankle to the gateway (raspberry pi). Then a FFT is applied to the incoming data to extract the amplitude and dominant frequency of each four-second epoch of data. A preliminary database is then created from FFT parameters where results are matched to each activity.

No. Mode of Exercise Intensity Frequency (Hz) Amplitude (m/s 2 ) Estimated Indicator for Measure of Intensity
The first recognition method is a direct method and is based on the direct use of the relational table shown above (Table 3). Every four seconds of incoming data (frequency and amplitude measures) are compared with a relational table comprising activity codes representing average frequency and intensity values for each exercise. The table is then used to recognize the activity and calculate the credit effort.
Method two and three are quite similar. Both are based on working out recognition consistency through examining a short-term history of the data recognized using method 1. Each minute of incoming data (15 readings of four second epochs of recognized outcomes) is stored in a temporally buffer then recognized through calculating the majority of occurrences of specific activities detected via method 1. If the consistency of a particular activity is more than a certain percentage of the total activity (for example, greater than 80% of data represents the amplitude and frequency components of a specific activity), then all the data throughout that minute is credited as the dominant single activity. If this consistency is not achieved, the system shows nonspecific activity (NSA). Method three is similar to method two with the addition of a moving one-minute window that overlaps by 28 s (a total of seven, four-second epochs). This improves the recognition timing precision by covering the transition time between activities. Figures 2 and 3 show one hour of activity for an individual performing different types of physical exercise at different intensities. These figures also show samples of amplitude and frequency data used to detect the presence of a specific physical activity, as well as activity recognition, the time lapsed, and accumulation of credit points.   Specific activities and intensities are identified using amplitude and frequency extracted by the FFT analysis technique [12]. Equation (1) is applied to each pair of incoming data to calculate the credit gained during the session and then the output results are stored in a comma-separated value (CSV) file for further analysis. The results of three recognition methods are stored in a CSV file (Figure 2a,b) and a time stamp with the accumulated time and credit gain of each activity is shown in Figure 2c,d. The system displays the summary and stores the result in a CSV file each minute. In addition, new incoming data is stored in the same CSV file sequentially with a time stamp, regardless of the length of time between two sessions. Figure 2a,b illustrate FFT amplitude and frequency measures over one hour. During the first 15 min there are consistent frequency and amplitude data that identify the activity of cycling at a low (CL), moderate (CM), and vigorous (CV) intensity. Figure 2c,d display the accumulated credit data over one hour for the different physical activities at different intensities.
The system stores the recognized activity, the period of each activity and the credit gain log file in real time. The system also summarizes the physical activities, exercise duration, and gained credit against each physical activity recorded over a 24-h period. Equations (1)-(3) calculate the total daily and weekly credits, respectively, while Equation (4) detects bed rest. Figure 3a illustrates six different exercises performed at light, moderate, and vigorous intensities. The amplitude and accumulated time reference are on the left axis, while the remainder of variables have their scale on the right-hand axis. The symbols CL, CM, CV are cycling at low, medium, and vigorous intensity, respectively. TML, TMM, and TMV are treadmill walking at light, moderate, and vigorous, respectively. CTM and CTV are the cross-trainer exercise performed at moderate and vigorous intensity. STP and STRM are step up and staircase ascending and descending at moderate intensity. WL and LEP represent walking a light intensity and leg press at vigorous intensity. Table 4 compares the three methods used in the model for calculating credit gain and the detected accumulated exercise time for the six physical activities shown in Figure 3a. These results are compared with the "ideal" credit gain determined by observation. Method 1 directly accumulates the time and calculates the credit gain for any recognized activity. Table 4 shows that approximately 18% of actual credit gain is not detected by Method 1 because it does not include any of the time and intensity measures from any of the unrecognized activities. Methods 2 and 3 differ from method 1 in that they assume that any unrecognized data epochs detected throughout each minute should be assigned to a specific activity, provided that over 80% of the remaining epochs consistently recognize the same type and intensity of activity. Therefore, these methods of recognition are able to detect a higher percentage (between 84-87%) of the ideal credit gain when compared to method 1 ( Table 4).
The system continuously accumulates time and credits daily throughout the week. At the end of the week, the total accumulated credits are stored with the summary of the gained credits as well as the type, duration, and intensity of physical activities detected throughout the seven-day period. Any periods of bed rest during the program are calculated at the end of each week and subtracted from the credit points that were gained during the prehabilitation program. The net total of credit points is then compared with the optimum value based on the program parameters originally developed by the clinician. Figure 4 shows the accumulated results (credits gained) of the different physical exercises described in Table 4 throughout a hour using the three methods. The trends show that method 1 tends to detect slightly less of the actual activity than methods 2 and 3. However, method 1 has the advantage of being able to calculate the exact time period and credit of each detected physical activity. Figure 5 shows credit accumulation throughout a six-week prehabilitation program.

Conclusions
This study has developed a model for a mixed prehabilitation program, which can provide online monitoring of the type and intensity of physical activity that patients engage in throughout the prehabilitation period. This model allows flexibility for the patient to perform a variety of physical activities in both indoor and outdoor environments and allows the choice of longer or multiple shorter exercise sessions at varying intensities. The report summary produced by this model also provides healthcare staff with an understanding of the level of exercise engagement the patient has made throughout the prehabilitation program. Furthermore, the model is able to provide real-time recordings of activity and inactivity data to determine whether further intervention is required. It also allows the patient to compensate for any missing sessions by undertaking additional physical activity that reaches the prehabilitation threshold requirements. The model provides a framework for automating the process and allowing the digital environmental within the Internet of Things (IoT) to be used effectively. Domain-related logical analysis has provided some improvements in capturing the real movements. Furthermore, artificial intelligence support like machine learning may help improve the movement recognition accuracy. Another important area for future interest is to determine the validity of this model to optimize aerobic capacity and reduce postoperative complications in patients undergoing major abdominal surgery.

Patents
The method and mathematical model have a filing date of 4 March 2021 with the reference "Prehabilitation and rehabilitation" under IP Number: 773589 in New Zealand Intellectual property.