Backend part of the OmicsPred Project
- OmicsPred website: https://www.omicspred.org/
- OmicsPred REST API website: https://rest.omicspred.org/
Manage import, querying and retrieval of the OmicsPred metadata:
- Scripts to import the metadata and generate the genetic scoring files (app imports -> README)
- Scripts to export the metadata and data (app exports)
- Access the databases (apps omicspred, plot) [read & write]
- Provide private (accessible by the website) and public REST APIs (app rest_api) [read only]
- Build and query the search engine (app search_es) using ElasticSearch [read & write]
| Tool | Role | Version |
|---|---|---|
| PostgreSQL | Database to store and query metadata | >= 18 |
| ElasticSearch | Server used as search engine | 8.xx (e.g. 8.19) |
| Django | Python framework to communicate with the database, the ElasticSearch indexes and build a REST API | 6.0.x (e.g. 6.0.7) |
Go to root of the repository (e.g. cd .../omicspred_backend)
-
Rename app.yaml_template to app.yaml and replace the <values> with your settings
-
Install the required Python packages with the commands:
pip install -r requirements.txt pip install -r requirements_local.txt # Only necessary for local deployement -
Create static directory
python manage.py collectstatic
-
Create ElasticSearch indexes
python manage.py search_index --create
[!WARNING] The indexing of the scores takes few hours (2-3h)!
To rebuild existing OmicsPred indexes:
python manage.py search_index --rebuild -f
-
For local deployment, run the command:
python manage.py runserver
This will create an instance of the Django apps on your local machine on
http://127.0.0.1:8000/ -
For cloud deployment (e.g. Google Cloud App Engine), after setting up the Cloud account on your laptop and updating the app.yaml file, run the command:
gcloud app deploy
Note
You will need to deploy the backend twice:
- One for the Public REST API with the app deployment name
service: restand the variablePUBLIC_SITE: 'True'. - One for the Private REST API (i.e. the one consumed by the OmicsPred website) with the app deployment name
service: rest-privateand the variablePUBLIC_SITE: 'False'.
See the different app.yaml configuration files already set in the Group Google Drive directoryWebsite -> Systems/Settings -> REST API (back-end)
Tests have been written for the metadata imports and the REST API. To run the tests manually, run the command:
python manage.py testNote
This runs the REST API, exports and imports tests
or to only run one test (e.g. metadata imports):
python manage.py test imports/tests