# Design, Implementation, and Field Testing
## 4 System Implementation  
### System Overview  
Figure 1 illustrates the PACTS system layout when deployed into multiple rooms. This version of PACTS is built on top of our initial version of the system [32; 39; 40]. To deploy PACTS in a room, one Kinect sensor and one computer are installed. The Kinect sensor is typically positioned close to  
the ceiling facing the bed where the patient will rest in. At least during the installation and initial configuration stage, the floor of the room should be clearly visible to the Kinect sensor. The computer runs the KinectServer process that takes input (via a USB cable) from the Kinect sensor and runs all the control logic for user registration, human activity monitoring, and alert reporting. Each user is supposed to wear a smartwatch (we use the Pebble smartwatch) and carry a smartphone (any Android phone or iPhone running the Pebble PhoneApp would work with PACTS). The smartwatch runs a WatchApp we developed and the smartphone runs a corresponding PhoneApp. The smartwatch is connected with the smartphone using Bluetooth. The smartphone connects to all deployed KinectServers via WiFi using JavaScript Object Notation (JSON) over HTTP. The primary role for the PhoneApp is to relay messages between the smartwatch (i.e., the WatchApp) and the KinectServer, although we do incorporate some mechanism to minimize the communication between the smartwatch and the smartphone to reduce the power consumption on both the smartwatch and the smartphone. The energy-saving is more important for the smartwatch because the battery on the smartwatch is quite small compared with that of the smartphone. The PhoneApp is configured to have the IP addresses of all KinectServers and communicate with the KinectServers periodically for the purpose of user registration, user activity detection, and other control needs. The broadcast-based design is necessary because the system has no prior knowledge which room a nursing assistant will go into to work. The KinectServer runs the main control logic of the system in each room. Hence, it is the most complicated component of PACTS. As shown in Figure 2, the KinectServer takes two forms of inputs:  
* Kinect input: The streams of the color and depth frames from connected Kinect sensors. * Network input: HTTP requests sent by the PhoneApps over the WiFi network. The Kinect input is used to detect user activities, including the registration gesture and the back-bending activity. The network input contains three types of requests:  
* Registration request: It is sent when a user has requested to register with the system. The response for the request indicates whether or not the registration has succeeded. Without the lease mechanism, this request is only initiated by the user via the WatchApp, the registration request will be broadcast to all known KinectServers. When the lease mechanism is enabled, the PhoneApp would periodically sends the registration request to the KinectServer that the user had manually  
Figure 1: The architecture of the privacy-aware compliance tracking system. registered with earlier when the user is temporarily unregistered (due to occlusion or due to her/him stepping out of the view of the Kinect sensor). * Activity status request: It is sent periodically once a user has registered with the system. The response indicates whether or not a back-bending activity has just been detected. * Stop-tracking request: It is sent when the user wishes the KinectServer to stop tracking temporarily due to privacy concerns, for example, when she is about to give the patient a sponge-bath to make sure that the system absolutely will not track anyone in the room. Once the stop-tracking request is received, the KinectServer also terminates the current lease, if any, for the user. Figure 3 illustrates how these types of requests interact with different components of the system. Only the manual registration request is broadcast to all KinectServers. All other types of requests are delivered point-to-point.