This project utilizes the industry-standard skills taught during this semester to implement a Patient Monitoring System that has a patient-side client, a monitoring-station client, and a server/database that allows patient data to be uploaded and stored on the server and retrieved for ad-hoc and continuous monitoring.
Our functional Patient Monitoring Server System encompasses with the following essential parts:
1) Cloud server,
2) Patient-side GUI,
3) Monitor-side GUI,
4) External MongoDB database
![]() |
|---|
| Patient monitoring server system overview design |
The system operates through the five Python files in this repository:
patient_side_GUI.py, where the user uploads patients' information and select images;main_server.py, which receives requests from the patient side/ monitor side to either store into MongoDatabase or return a patient instance;monitor_side_GUI.py, where the user accesses patient information with medical/ECG images displayed on the GUI interface;client.py, which connects to the server to send out eitherPOSTorGETrequests;database_definition.py, which defines fields of the Patient class in database (name,medical_record_number,medical_image,ecg_image,heart_rate,timestamp).
Besides, this repository also contains three unit testing files for all the functions used in the modules above.
-
The cloud server contains 3 routes, where one route receives
POSTrequest for information storage while two receiveGETrequest to retrieve medical information stored in database. All the relevant functions to send requests to server can be found inclient.py. -
The hostname and port on which the server is running is
vcm-23051.vm.duke.edu:5011
-
This route is design for new patient registration and update new medical information for existed patient records. All the data will be stored to external MongoDB database.
-
This route takes the below JSON format string:
{ "name": str, "medical_record_number": int, "medical_image": b64-string, "ecg_image": b64-string, "hr": int } -
The URL to access this route is
http://vcm-23051.vm.duke.edu:5011/api/new_patient
-
This route is design to return a lists of available medical record numbers from MongoDB database.
-
The URL to access this route is
http://vcm-23051.vm.duke.edu:5011/api/get_patient
-
This route is design to return a patient's medical information containing with name, ID, history of heart rates and their corresponding timestamps, ECG images and medical images, given the input of ID.
-
The URL to access this route is
http://vcm-23051.vm.duke.edu:5011/api/get_patient/<id>
-
The MongoDB database has the fields:
name,medical_record_number,medical_image,ecg_image,heart_rate,timestamp, which are self-descriptive by the names -
The database field definition shown as follow:
name = fields.CharField()
medical_record_number = fields.IntegerField(primary_key=True)
medical_image = fields.ListField()
ecg_image = fields.ListField()
heart_rate = fields.ListField()
timestamp = fields.ListField()
- The patient-side GUI is intended to upload patients' medical information by entering patient's name, id/ medical record number in the text entries respectively. In addition, users can also select medical image (*.jpeg/ .png) or raw ecg data (.csv) to display on GUI and upload them to established MongoDB database. For the selection of raw ecg data, the ecg raw data will be plotted and shown on the interface, along with the estimated heart rate. The GUI can display one medical image and one ecg image simultaneously.
-
To activate the GUI, users need to run the
patient_side_GUI.pyscript. One way to do that is by typingpython patient_side_GUI.pyon the terminal or open your preference IDE platform for python and run the script. -
The GUI window will show up shortly after running the script.
![]() |
|---|
| Patient-side GUI interface design |
-
Input the subject's
Nameif any and the patientIDcorrespondingly. -
Make sure to select the file type from the drop-down list of
Filetypecombobox prior to clicking theSelect Filesbutton to choose file to be uploaded. Otherwise, a warning message box will appear to prompt the user to select file type first. -
If necessary, click the
Reset Allbutton in the upper right corner to clear all the information entered on the interface so far. -
When the user is satisfied with current input, click the
Uploadbutton to upload the entered information to cloud database, and then everything on the interface will be removed. -
Click the
Quitbutton to exit the interface. Then, clickNoin the confirmation window to go back to the interface when accidental pressing; or clickYesto completely close the interface window.
Note:
i. Empty ID entry would render upload failure
ii. If entering a new ID, message will indicate New patient registered
iii. New info updates will be made to the existed medical record number
- The monitor-side GUI is intended to retrieve a particular patient's medical information given an input ID / medical record number. Upon the user chooses a medical record number from a list, a text message specifying patient's name, id, latest hear rate and its timestamp will automatically be shown on the top of the interface, along with latest ecg image if available. The users can also select from a whole list of ecg or medical images and visualize on GUI interface. Users have the options to download displayed images locally as well.
-
To activate the GUI, users first need to make sure
main_server.pyis running and the connection is built with the cloud Mongo database. And then, run themonitor_side_GUI.pyscript. One way to do that is by typingpython monitor_side_GUI.pyon the terminal or open your preference IDE platform for python and run the script. -
The GUI window will show up shortly after running the script.
![]() |
|---|
| Monitor-side GUI interface design |
-
Select an ID number from
IDdropdown box. The patient information and latest ECG image will automatically display. -
In addition, select a historical ECG images from the drop-down list of
Available ECG imagecombobox. The selected image will display in the Selected ECG Image area. -
Select a medical image from the drop-down lists of
Available medical imagecombobox. The selected image will display in the Medical Image area. -
Click the
Downloadunder which image the user would like to save. Choose a local directory in the pop-up directory selection window, and enter a filename in the subsequent dialog window to save the selected image. -
To get information of a new patient, simply change the selection of patient number in the
IDcombobox. Any old information will be removed or replaced by the starting information of the new patient. -
Click the
Quitbutton to exit when the user is done using this interface. ClickNoin the confirmation window to go back to the interface when accidental pressing; or clickYesto completely close the interface window.
Note:
i. The GUI will automatically update info for the selected patient ID every 5s


