Vita is a mobile application that facilitates a patient monitoring system for residents in senior homes. The aim of this project was to help address the shortage of healthcare workers while promoting the safety and health of senior citizens in assisted living.
Want to see more? Check out our Devpost submission or our Figma prototype.
During the pandemic, nursing homes recorded a high number of deaths. These 40,000 deaths were not a result of COVID-19, rather they were a result of understaffing in nursing homes.1
Up to 90% of nursing homes are understaffed, and one nurse’s aide may have to take care of up to 15 patients at once when they’re only supposed to have 7 or 8.2 46% of nurses also said they’ve missed changes in a patient’s condition because of their excessive workload.3
As a result of these unfortunate statistics, we asked ourselves the following question:
How might we develop a digital solution that helps relieve some of the burden understaffed care workers go through, essentially helping them take care of their patients?
Vita is composed of four major components:
- Patient Simulator
- Firebase Backend
- Heart Attack Detection Model
- Mobile Application
Patient Simulator (simulator/
) 🧑⚕️
The patient simulator was written using Python and concurrent programming using the asyncio library.
Each simulated patient executes as its own routine in parallel with other. This routine does the following:
- Grabs the latest ECG and location data from the patient
- Use the machine learning model to check if the patient is experiencing a heart attack or not
- If the patient is experiencing a heart attack, the mobile app is notified
- Push the latest information to the firestore database
To simulate a heart attack, the simulator also supports I/O by writing a custom signal handler for keyboard interrupts. The normal ECG for a patient is swapped for an ECG that indicates that myocardial infarction is occurring, which the model will pick up.
This process repeats indefinitely.
The main purpose of the firebase backend was to facilitate the data transfer between the simulator and the mobile app. In addition to acting as our database, firestore was selected particularly because of its realtime transmission capabilities since our application relied on such behavior.
We used a single collection called patients
storing a document for each patient. Each document
had the following structure (with some example data):
{
"age": 55,
"birthdate": "1969-01-15",
"emergency_contact": {
"name": "Jane Doe",
"phone": "555-555-5555"
},
"medical_history": "Type I Diabetes",
"name": "John Doe",
"room": "6",
"sensor_data": {
"ecg": [
0.193,
0.198,
0.244,
// 10 seconds of data stored sampled at 100Hz
],
"is_having_heart_attack": false,
"location": "HEARTH ROOM",
}
}
Heart Attack Detection Model (machine_learning/
) 📶
The heart attack detection model uses a convolutional neural network and classifies the last 10 seconds of a patients ECG to indicate that they are experiencing a heart attack.
We used the PTB-XL dataset to train the model.4 We started by processing the dataset with the following steps:
- Filtered for documents labeled as "Normal ECG" and "Myocardial Infarction" (heart attack) sampled at 100Hz
- Computed a distribution of peak-to-peak voltages for each ECG label and kept samples within 1 standard deviation
- The dataset was split into four: train, validation, test, and deployment
We then trained a convolutional neural network to classify each ECG in the dataset. The following is the
model architecture used (from model.summary()
in tensorflow):
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
conv1d_25 (Conv1D) (None, 64, 993) 576
batch_normalization_9 (Bat (None, 64, 993) 3972
chNormalization)
leaky_re_lu_25 (LeakyReLU) (None, 64, 993) 0
max_pooling1d_25 (MaxPooli (None, 32, 993) 0
ng1D)
conv1d_26 (Conv1D) (None, 32, 988) 6176
leaky_re_lu_26 (LeakyReLU) (None, 32, 988) 0
max_pooling1d_26 (MaxPooli (None, 16, 988) 0
ng1D)
conv1d_27 (Conv1D) (None, 16, 985) 1040
leaky_re_lu_27 (LeakyReLU) (None, 16, 985) 0
max_pooling1d_27 (MaxPooli (None, 8, 985) 0
ng1D)
conv1d_28 (Conv1D) (None, 8, 983) 200
leaky_re_lu_28 (LeakyReLU) (None, 8, 983) 0
max_pooling1d_28 (MaxPooli (None, 4, 983) 0
ng1D)
flatten_9 (Flatten) (None, 3932) 0
dense_18 (Dense) (None, 1000) 3933000
dropout_9 (Dropout) (None, 1000) 0
dense_19 (Dense) (None, 100) 100100
dropout_10 (Dropout) (None, 100) 0
dense_20 (Dense) (None, 1) 101
=================================================================
Total params: 4045165 (15.43 MB)
Trainable params: 4043179 (15.42 MB)
Non-trainable params: 1986 (7.76 KB)
_________________________________________________________________
We were able to achieve 93% accuracy on our test dataset as a result of training after just 10 epochs.
Mobile Application (frontend/
) 📱
The mobile application was crafted using React Native with Expo, where we tranformed Figma designs into dynamic and functional React components.
When the app is first launched, there are a series of welcome screens that give background information and instructions.
In the beginning of each shift, a care worker can add the patients they are assigned to.
Next, they will be able to monitor the ECG readings of each patient that they have added in real time. There is also access to more detailed information of a patient.
Lastly, the care taker can view the indoor map rendered with the MappedIn SDK that contains the current locations of each of the patients that get updated as they move around due to Cloud Firestore.
If a patient requires immediate assistance, our Heart Attack Detection Model will notify Firestore, where the update will be immediately reflected in our mobile application along with a push notification to alert care takers who are currently not in app. We used the MappedIn SDK to create the shortest path to reach the patient in need.