MEDWings

Mobile Early Deterioration Warning System.

MEWS

The following vital signs need to be recorded for a MEWS calculation:

  • Heart Rate
  • SPO2
  • Blood Pressure
  • Body Temperature
  • Respiration Rate

A detailed explanation and formula can be found here.

Handheld Devices

We have procured the following devices for vitals data measurement:

API Access

Data is gathered by taking measurements using the devices, either actively (BP sleeve, thermometer) or passively (smartwatch). The devices are connected to the Withings mobile app. The mobile app then regularly pushes gathered data to the Withings cloud.

The Withings Dev Free plan allows for 120 API requests per minute. Access to vitals data is available through the Withings API.

A detailed API integration guide, as well as an API reference guide are available online.

Development

To start the development compose-stack, run the following command:

sudo docker-compose -f development.docker-compose.yml up --force-recreate --build --remove-orphans

To start the frontend asset bundler, run:

npm run start

It supports file watching and hot reloading of the browser window.

To clean the bundle files, run:

npm run clean

Backend

To run commands inside the backend container, run the following:

sudo docker exec -it medwings-django <command>

Run database migrations inside the running container like so:

sudo docker exec -it medwings-django python manage.py migrate

To enter django's interactive shell, run:

sudo docker exec -it medwings-django python manage.py shell

Notification server

Steps to create a new user's channel on gotify:

  1. Using admin credentials in basic auth, create a new gotify user with the django user's credentials.
  2. Save the user's id in the DB.
  3. Using the user's credentials in basic auth, create a new gotify application called Medwings.
  4. Save the application token and application id in the DB.
  5. Optional: upload an application picture to make the notifications look a bit nicer
  6. Pushing notifications to this user now works as follows: curl "https://medwings.com/message?token=<app token>" -F "title=Time for a measurement." -F "message=Bla bla."

Deployment

Build the asset bundle:

npm run build

In the root directory, create a file named .env and fill it with environment variables containing your access and connection credentials:

TIMEZONE=Europe/Berlin
PG_NAME=medwings
PG_USER=medwings
PG_PASSWORD=<secret>
PG_HOST=medwings-postgres
PG_PORT=5432
GOTIFY_USER=<secret>
GOTIFY_PASSWORD=<secret>
GOTIFY_HOST=medwings-gotify
WITHINGS_CLIENT_ID=<secret>
WITHINGS_CLIENT_SECRET=<secret>

Substitute each <secret> with your information as follows:

  • PG_PASSWORD: A random string, at least 32 characters
  • GOTIFY_USER: Can be a username of your choice, for the Gotify server admin user
  • GOTIFY_password: A random string, at least 8 characters
  • WITHINGS_CLIENT_ID: Your Withings Developer API Client ID
  • WITHINGS_CLIENT_SECRET: Your Withings Developer API Client Secret
Description
Code, Data and Paper for Medwings - My bachelor thesis.
Readme 73 MiB
Languages
Python 44.8%
HTML 34.1%
CSS 14.3%
Dockerfile 3.4%
JavaScript 3.2%
Other 0.2%