Skip to content

Commit

Permalink
Merge branch 'main' into 335-add-performance-tests-for-front-and-back…
Browse files Browse the repository at this point in the history
…end-to-evaluate-330
  • Loading branch information
Wolkenfarmer committed Oct 17, 2024
2 parents 073a5b9 + 48ee2fb commit bbf22eb
Show file tree
Hide file tree
Showing 17 changed files with 3,109 additions and 2,992 deletions.
25 changes: 25 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# k-dPS Team
- [Claas Gade](https://github.com/claasga)
- [Johannes Westergerling](https://github.com/wolkenfarmer)
- [Joshua Riewesell](https://github.com/JoshuaRiewesell)
- [Toni Poredda](https://github.com/Toni000)

# Other Contributors
The [backend](backend) was partly based on the [dps.training_server repository](https://github.com/hpi-sam/dps.training_server) with following contributors:
- [Nils Cichy](https://github.com/inadicis)
- [Chiara Schirmer](https://github.com/Schirmchens)
- [Patricia Sowa](https://github.com/PatriciaSowa)
- [Julian Baumann](https://github.com/jeriox)
- [Christian Schäffer](https://github.com/christianzoellner)

# Special Thanks
## Project supervisors
- [Christian Schäffer](https://github.com/christianzoellner)
- [Matthias Barkowsky](https://github.com/mbarkowsky)

## Data provider
Individuals responsible for creating and auditing the data - see the respective [readme](backend/dps_training_k/data/README.md) and
[license](backend/dps_training_k/data/LICENSE)
- Frank Sensen
- Philipp Rocker
- Wolfram Pohlheim
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 k-dPS Team and other contributors, see AUTHORS.md

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ The following list describes where to find the documentation for the different p
- Tips regarding the project configuration: [docs file](./docs/configuration-tips.md).
- MoSCoW and future plans: [docs file](./docs/moscow.md).

## Project Licensing
The majority of this project is licensed under the MIT License, as found in the [LICENSE](./LICENSE) file at the root of this project. However,
some components are licensed differently:

- **data**: The code and content within `backend/dps_training_k/data` are licensed under the CC BY-NC license, as detailed in the
[backend/dps_training_k/data/LICENSE](./backend/dps_training_k/data/LICENSE) file. This license prohibits the use of the data for commercial use.
Consequently, the data needs to be removed or replaced or licensing addendums have to be negotiated if the project should be used commercially. For
more details, see the [backend/dps_training_k/data/README.md](./backend/dps_training_k/data/README.md) file.


## Thank you
First and foremost, we would like to thank the [Hasso Plattner Institute](https://hpi.de/) for giving us the opportunity to work on this project as well as our
supervisors Christian Schäffer and Matthias Barkowsky for their guidance and organization of the project.
Expand All @@ -61,6 +71,6 @@ And last but not least, we would like to thank our supporters:
Special thanks to the following people for being directly available to us and providing us with valuable insights and feedback: Frank Sensen
(ZaNowi), Philipp Rocker (Johanniter) and Daniel Schmitz (Evangelisches Krankenhaus Hubertus).

![](docs/hpi_logo.png)
![](./docs/hpi_logo.png)
![](./docs/johanniter_logo.png)
![](./docs/zanowi_logo.png)
40 changes: 26 additions & 14 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# Klinik-dPS Backend

The simulation logic and database management for the K-dPS project. For the interactive website see the [frontend folder](../frontend/README.md).

For general information on the project like e.g. licensing information or future plans, see the [Project README](../README.md).

## Setup

### Install Python

- install from official [python website](https://www.python.org/downloads/)
- version should be at least 3.12


### Install requirements

- navigate into backend folder
- `pip install -r requirements.txt`

### Setup Black Formatter

We are using black as a biased formatter for the whole project. For more information about black see: [Black](https://black.readthedocs.io/en/stable/)

- make sure you have python extension installed
- download "Black Formatter" from marketplace
- right-click on a python file
Expand All @@ -26,45 +31,52 @@ We are using black as a biased formatter for the whole project. For more informa
- enable "Editor: Format on Save"

## Running the project using Docker
Running the project without docker is currently not tested/supported.

Running the project without docker is currently not tested/supported.
For more information on the difference between `prod` and `dev`, see the [docs file](../docs/deployment-process.md).
Note that the `prod` env file here still assumes this is running locally -
Note that the `prod` env file here still assumes this is running locally -
meaning it will expect the frontend to run on localhost.

Build and run:

```bash
docker compose --env-file .env.<prod/dev> up --build
```

Optionally, to access the database, create a superuser account:
Optionally, to access the database, create a superuser account:

```bash
docker exec -it K-dPS-django python manage.py createsuperuser
```

Afterwards, you can log into the admin interface at e.g. `http://localhost:80/admin/`<br/>
Note: this is only available if DEBUG = true, which is the case in the dev environment.


## Development

### Migrations

When changing models, you need to create migrations in order to update existing databases.

- Create new migrations: `docker exec -it K-dPS-django python manage.py makemigrations`
- Optionally, if you have conflicting migrations: `docker exec -it K-dPS-django python manage.py migrate --merge`
- Execute these migrations to update the database: `docker exec -it K-dPS-django python manage.py migrate`

### Running Tests

- start docker container with docker compose(see Running the project using Docker)
- wait until Application Startup is Completed
- run: `docker exec -it K-dPS-django python manage.py test`

### Working with Fixtures
- (clear database)
- fill database with data you want to export as fixture (e.g. `docker exec -it K-dPS-django python manage.py import_patient_states`)
- if updating a fixture that is used by a model that doesn't allow null fields, make them nullable, migrate and discard the migration file
afterwards.
- create fixture:
- `docker exec -it K-dPS-django bash`
- `export PYTHONIOENCODING=utf8`
- `python manage.py dumpdata template > patient_states.json`
- move the fixture to the "fixtures" directory

Example given for creating the "patient_states.json" fixture containing all patientstates, statetransitions, subconditions and logicnodes.

- clear database of the wanted models via e.g. `docker exec -it K-dPS-django python manage.py flush`
- fill database with data you want to export as fixture: `docker exec -it K-dPS-django python manage.py import_patient_states`
- create fixture:
- `docker exec -it K-dPS-django bash`
- `export PYTHONIOENCODING=utf8`
- `python manage.py dumpdata template.patientstate template.statetransition template.subcondition template.logicnode >
data/fixtures/patient_states.json`
- now you can load it: `docker exec -it K-dPS-django python manage.py loaddata patient_states.json`
12 changes: 7 additions & 5 deletions backend/dps_training_k/configuration/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG")
CORS_ORIGIN_ALLOW_ALL = DEBUG
CORS_ALLOWED_ORIGINS = ["https://klinik-dps.de", "https://www.klinik-dps.de", "http://localhost"]
CORS_ALLOWED_ORIGINS = [
"https://klinik-dps.de",
"https://www.klinik-dps.de",
"http://localhost",
]
RUN_CONFIG = env.str("RUN_CONFIG", default="dev")

CSRF_TRUSTED_ORIGINS = ["http://localhost:8000"]
Expand Down Expand Up @@ -127,18 +131,16 @@
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = "static/"

FIXTURE_DIRS = ["data/fixtures"]

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

Expand Down
6 changes: 6 additions & 0 deletions backend/dps_training_k/data/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Creative Commons Attribution-NonCommercial 4.0 International License

Copyright (c) 2024 k-dPS Team, Frank Sensen, Philipp Rocker and Wolfram Pohlheim, see AUTHORS.md

This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
24 changes: 24 additions & 0 deletions backend/dps_training_k/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Data Directory Documentation

## Overview
This directory contains data used by the K-dPS. The data here is integral to various functionalities within the project and is subject to
specific licensing conditions that restrict its use to non-commercial purposes.

## Licensing
The contents of this directory are licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC). This license
allows for redistribution, derivative creation, and adaptation of this work, strictly for non-commercial purposes, as long as attribution is given to
the original creators.

### License Summary
- **Non-Commercial Use Only**: The data may only be used for non-commercial purposes. This includes academic research, personal projects, and
educational use.
- **Attribution**: If you redistribute or use the data in any form, appropriate credit must be given, providing a link to the license, and indicating
if changes were made.
- **Redistribution and Sharing**: Redistribution of this data is permitted under the condition that it is not used for commercial purposes. All
redistributed copies or adaptations must also be licensed under the same terms.

For the full license text, please refer to the [LICENSE](./LICENSE) file in this directory.

## Removing or Replacing Data for Commercial Use
If you intend to use the project commercially, the data in this directory must be removed, replaced with data that is licensed for commercial use, or
a different license must be negotiated that allows for such use.
Loading

0 comments on commit bbf22eb

Please sign in to comment.