# 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](https://www.mdcalc.com/calc/1875/modified-early-warning-score-mews-clinical-deterioration#evidence).

# Handheld Devices

We have procured the following devices for vitals data measurement:

* [Withings Scanwatch](https://www.withings.com/de/en/scanwatch) 
  * Heart Rate, SPO2
* [Withings Thermo](https://www.withings.com/de/en/thermo) 
  * Body Surface Temperature
* [WIthings BPM Core](https://www.withings.com/de/en/bpm-core) 
  * Blood Pressure

## 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](https://developer.withings.com/).

A detailed [API integration guide](https://developer.withings.com/developer-guide/v3/integration-guide/public-health-data-api/public-health-data-api-overview/),
as well as an [API reference guide](https://developer.withings.com/api-reference) are available online.

# Development

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

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

To run commands inside the backend container, run the following:
```bash
sudo docker exec -it medwings-django <command>
```

Run database migrations inside the running container like so:

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

To enter django's interactive shell, run:
```bash
sudo docker exec -it medwings-django python manage.py shell
```
