ba-thesis/README.md

94 lines
3.6 KiB
Markdown
Raw Normal View History

2023-05-10 17:19:38 +02:00
# MEDWings
Medwings is the *Mobile Early Deterioration Warning System*.
2023-08-02 15:17:46 +02:00
It is a proof of concept for a remote patient monitoring system, designed for use by elevated-risk patients
outside of direct medical supervision, such as at home or on the go.
2023-05-10 17:19:38 +02:00
The application utilizes smart medical devices to access vitals data gathered by users remotely.
Data is aggregated, and a clinical early warning score is calculated based on the readings.
2023-04-26 10:24:36 +02:00
2023-08-02 15:17:46 +02:00
The Medwings application is split into different modules, each handling a specific responsibility:
- [core](./app/core/README.md): global files and configuration
- [authentication](./app/authentication/README.md): user creation and login/logout management
- [medwings](./app/medwings/README.md): everything related to vitals data and MEWS calculation
- [gotify](./app/gotify/README.md): interfaces to the notification server
- [withings](./app/withings/README.md): interfaces to the Withings API
You can read more about each module and its functionality in each section mentioned above.
2023-04-26 10:24:36 +02:00
## Development
2023-04-26 10:24:36 +02:00
### Sensitive Configuration Data
2023-04-26 10:24:36 +02:00
To avoid leaking sensitive configuration data, such as database passwords or API keys, all such values are stored in the
`.env`-file.
2023-04-26 10:24:36 +02:00
Prior to running the application, you must create a file called `.env` in the project root.
The file contains the following environment variables:
2023-04-26 10:24:36 +02:00
```conf
TIMEZONE=Europe/Berlin
2023-08-17 18:19:46 +02:00
DJANGO_DEBUG_MODE=false
DJANGO_SECRET_KEY=abc123mySecret
PG_NAME=medwings
PG_USER=medwings
PG_PASSWORD=secret
PG_HOST=medwings-postgres
PG_PORT=5432
GOTIFY_USER=gotify
GOTIFY_PASSWORD=secret
GOTIFY_HOST=medwings-gotify
GOTIFY_PUBLIC_URL=https://notifications.medwings.example.com/
2023-08-02 15:17:46 +02:00
WITHINGS_CLIENT_ID=abc123myClientId
WITHINGS_CLIENT_SECRET=abc123myClientSecret
```
2023-04-26 10:24:36 +02:00
You should set the values of the following variables:
2023-04-26 10:24:36 +02:00
| variable | description | value |
|----------|-------------|-------|
2023-08-17 18:19:46 +02:00
| DJANGO_DEBUG_MODE | whether or not to enable Django's debug mode | 'true' during development and 'false' in production |
| DJANGO_SECRET_KEY | private session secret | a random string of 64 characters or more |
| PG_PASSWORD | password for the PostgreSQL admin user | a random string of 32 characters or more |
| GOTIFY_USER | name of the Gotify admin user | a random string of 32 characters or more |
| GOTIFY_PASSWORD | password for the Gotify admin user | a random string of 32 characters or more |
2023-08-02 15:17:46 +02:00
| GOTIFY_PUBLIC_URL | URL where your public Gotify server can be reached | this depends on your deployment environment |
| WITHINGS_CLIENT_ID | Your Withings API client id | see [Withings API](./app/withings/README.md#api-access) |
| WITHINGS_CLIENT_SECRET | Your Withings API client secret | see [Withings API](./app/withings/README.md#api-access) |
### Starting the dev environment
2023-07-31 02:41:13 +02:00
Once your environment vars are set up, you can run the backend and webserver, by running the following command:
2023-06-14 11:26:43 +02:00
```bash
sudo docker-compose -f development.docker-compose.yml up --force-recreate --build --remove-orphans
```
In a separate terminal, you should also start the frontend asset bundler:
2023-07-21 12:04:00 +02:00
```bash
npm run start
```
It supports file watching and automatic recompilation of the project's CSS and JS bundle.
2023-07-21 12:13:22 +02:00
#### Running commands inside the container
2023-07-21 12:13:22 +02:00
To run commands inside the django container, run the following:
2023-07-21 12:13:22 +02:00
```bash
sudo docker exec -itu django medwings-django <command>
2023-07-21 10:57:46 +02:00
```
Run database migrations inside the running container like so:
```bash
2023-08-17 20:14:34 +02:00
sudo docker exec -itu django medwings-django python manage.py migrate
```
2023-06-15 14:01:04 +02:00
2023-07-21 10:57:46 +02:00
To enter django's interactive shell, run:
2023-06-15 14:01:04 +02:00
```bash
2023-08-17 20:14:34 +02:00
sudo docker exec -itu django medwings-django python manage.py shell
2023-07-21 12:13:22 +02:00
```