## 4 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. 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. 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