The Harvey Mudd College Clinic program engages juniors and seniors in solving real-world, technical problems for companies and organizations. The City of Hope, a National Cancer Institute-Designated Comprehensive Cancer Center, is sponsoring a project for the 2022-2023 school year. The work from this E205 project is contributing to the City of Hope Clinic project.
The City of Hope Clinic Team at Harvey Mudd College is aiming to design and prototype an implantable medical device that can monitor activity-levels of postoperative cancer patients. Higher activity level correlates with positive outcomes after surgery. Collecting activity-level data can give caregivers insight into the patient's recovery status and wellbeing. The device is intended to be implanted in a patient’s clavicle, just under the skin.
An LIS3DH accelerometer communicates with the STM32F401RE microcontroller over SPI. The schematic and image of the setup are shown in Figures 1 and 2.
The setup was connected to the laptop via USB, and the C code interfacing the microcontroller and accelerometer was uploaded to the microcontroller via the STLINK protocol in PlatformIO, the embedded systems platform used in this project. Data collected by the accelerometer was sent back to the laptop via UART and was printed to the serial monitor. This data is read into Python using the PySerial library. Data is collected with a test subject holding the breadboard to the right clavicle area with their right hand and the laptop in the left hand, as shown on the right. Data is collected at a rate of 1.4 Hz.
The accelerometer collects acceleration data in the x, y, and z directions (units not calibrated). Since the orientation of the accelerometer may not be able to be determined due to variable positioning in the patient’s body during the implantation surgery, the overall acceleration vector will be used for data processing. The equation for total acceleration (also referred to as "energy" in some areas of this report) is shown in the equation below.
Figure 1. The microcontroller and accelerometer setup
Figure 2. Microcontroller and Accelerometer Circuit Diagram
Figure 3. Data Collection
A Bayes Filter is an algorithm that is used to determine a system’s state based on prior knowledge and incoming sensor data, as shown in Figure 4.
Figure 4: Block Diagram of Bayes Filter inputs and outputs
Based on conversations with the researchers at City of Hope, the relevant states a patient can be in are lying down, sitting, walking, or jogging. First, total acceleration data from each of the states is provided to the model to serve as training data. A Gaussian distribution is fitted to the data to produce probability density functions (PDF). The PDFs of the training data are provided in Figure 5. The integral of each distribution sums to one, as it encompasses the total probability of that state. Training data was collected from the three team members.
Figure 5: Gaussian fits to the training data
The algorithm itself has two steps: a prediction step and a correction step. The prediction step uses the prior state and a mathematical model to predict the current state. In this case, probabilities of moving from one state to another, also known as transition probabilities, serve as this mathematical model. The transition probabilities are shown in Table 1.
Table 1. Probability State Transition Table
Next, the correction step takes in current data from the accelerometer and checks it against the training data to create a belief of the current state. The beliefs from the prediction step and correction step are then combined to produce the current state.
Kaanthi's Trial: video of Kaanthi (left), screen recording of real time Bayes Filter State Estimation (right)
Amy's Trial: video of Amy (left), screen recording of real time Bayes Filter State Estimation (right)
Sidney's Trial: video of Sidney (left), screen recording of real time Bayes Filter State Estimation (right)
Trials were run to determine the accuracy of the Bayes filter. The filter performs particularly well for the sitting, lying down, and walking states. Because the jogging state data has a larger standard deviation than the other states, the jogging state has a larger potential for error.
Figure 6 displays the Bayes filter results for a single trial of a test subject performing approximately 20 seconds each of sitting, walking, lying down, walking, jogging, walking, sitting and lying down respectively. As can be seen from the figure, the filter is best at identifying the states sitting, lying down, and walking and has the most trouble identifying jogging.
Figure 6: Bayes Filter results for Amy's Trial
Accuracy was determined by comparing the Bayes filter results to the known state of the trial subject at that time step. The accuracy rate of the filter was 84% in this trial. For the 3 trials performed, the average accuracy rate was 80%.
The state estimate accuracy by trial represents the number of correctly identified states over the total number of state estimates in these particular trial runs where the team members were performing approximately 20 seconds each of sitting, walking, lying down, walking, jogging, walking, sitting and lying down respectively.
Amy's Trial: 84% accuracy
Kaanthi's Trial: 78% accuracy
Sidney's Trial: 78% accuracy
These accuracies by state show that the algorithm's state estimate results are significantly better than random chance.
Lying down: 87.5% accuracy
Sitting: 89.5% accuracy
Walking: 89.4% accuracy
Jogging: 51.0% accuracy
This project serves as a proof of concept that an accelerometer worn on the chest can be used to characterize patient activity.
There are two ways that this system could be improved upon in future work. First, data from an additional sensor, such as a heart rate monitor or a blood pressure monitor, could be used in tandem with the accelerometer data to improve the state estimate. Second, we expect that a larger quantity of training data will yield more accurate results. In this project, only a few minutes of training data were taken from the three team members. In the future, if this product is deemed commercially viable, much more training data will need to be obtained. Once the product becomes widely used, incoming patient data can be added to the overall training dataset, enabling the state estimation to become more and more accurate over time.