cp cohort_back/example.settings.py cohort_back/settings.py
"${EDITOR:-vi}" cohort_back/settings.py
pip install -r requirements.txt
python manage.py makemigrations cohort
python manage.py makemigrations explorations
python manage.py migrate
python manage.py loaddata cohort/fixtures/data.json
You can use two methods to authenticate users: simple or via LDAP (both need a user+password).
You will then be able to get a JSON Web Token (JWT) to further authenticate to other urls of this API.
- The first step is to create a user using a signup view and by specifying if it is via simple or LDAP auth.
- The user can now authenticate at
/api/jwt/
by specifying ausername
and apassword
in the request data. This will return a JSON response containing an access and a refresh token. - The user can now use its access token to browse other API urls by specifying it in the request authorization header ("Authorization: Bearer <the-access-token-here>").
- When the access token expires, use the
/api/jwt/refresh
url by specifying therefresh
token in the request data. This will return a JSON response containing a new access token.
The Swagger documentation is available at /docs/ when the server is running.
Cohort back-end does not store any medical data. It only stores OMOP/FHIR ressources ids.
Il faut créer le fichier de migration associé avec la commande
python manage.py makemigrations <nom-du-module>
-> ça crée un fichier de migration dans /migrations
Puis
python manage.py migrate
pour l'appliquer en BDD.
First launch celery:
celery worker -B -A cohort_back --loglevel=info
Then launch the API:
python manage.py runserver