Translator OpenPredict 🔮🐍

Translator API to compute and serve predictions of biomedical concepts associations

Python versions Version SonarCloud Coverage SonarCloud Maintainability Rating CII Best  Practices

Testing plan for the OpenPredict API published at https://openpredict.semanticscience.org

Manual tests

Use the docs/openpredict-examples.ipynb Jupyter notebook to manually try queries against the OpenPredict API.

Automated testing plan

Testing of the Translator OpenPredict API is separated in 3 parts:

When one of those 3 workflows fails we take action to fix the source of the problem.

Requirementsm to run the tests: Python 3.6+

Install the required dependency if you want to run the tests locally:

pip install pytest

Production tests

Test production API

Integration tests are run automatically by the GitHub Action workflow .github/workflows/run-tests-prod.yml everyday at 01:00am GMT+1 on the OpenPredict production API

We test for an expected number of results and a few specific results.

To run the tests of the OpenPredict production API locally:

pytest tests/production

Integration tests

Run tests

Integration tests on a local API are run automatically by the GitHub Action workflow .github/workflows/run-tests.yml at each push to the master branch.

We test the embeddings computation with a Spark local context (setup with a GitHub Action), and without Spark context (using NumPy and pandas)

You can run the tests for the different components of OpenPredict locally:

pytest tests/integration

To run a specific test in a specific file, and display print() lines in the output:

pytest tests/integration/test_openpredict_api.py::test_post_trapi -s

Docker tests

Publish Docker image

At each new release we run the GitHub Action workflow .github/workflows/publish-docker.yml to test the deployment of the OpenPredict API in a Docker container, and we publish a new image for each new version of the OpenPredict API.

Additional tests

CodeQL analysis

We run an additional workflow which to check for vulnerabilities using the CodeQL analysis engine.

Known issues

Facing issue with pytest install even using virtual environments? Try this solution:

python3 -m pip install -e .
python3 -m pip install pytest
python3 -m pytest