Skip to main content

An API to compute and serve predictions of biomedical concepts associations via OpenAPI, using the PREDICT method, for the NCATS Translator project

Project description

Version Run tests Publish package

Translator OpenPredict 🔮🐍 is an API to compute and serve predicted biomedical concepts associations, for the NCATS Translator project.

This service has been built from the fair-workflows/openpredict project.

Use the API

The Translator OpenPredict API Swagger UI is publicly available at openpredict.137.120.31.102.nip.io

You can find a Jupyter Notebook with examples to query the API on GitHub

Install the package 📦

You might want to use a virtual environment for Python 3.7

# Create the virtual environment
python3 -m venv .venv
# Activate it
source .venv/bin/activate

From PyPI

Install the latest release published on PyPI 🏷️

pip install openpredict

PyPI link : https://pypi.org/project/openpredict

From GitHub

You can also install from the latest version of the source code on GitHub:

pip install git+https://github.com/MaastrichtU-IDS/translator-openpredict

Run the API 🌐

After installing the openpredict package (except for docker).

Run from the command line

Run in production with Tornado Web Server 🌪️

openpredict start-api

Access the Swagger UI at http://localhost:8808

Provide the port as arguments:

openpredict start-api --port 8808

Run in development with Flask 🧪. The API will reload automatically at each change 🔃

openpredict start-api --debug

Show help:

openpredict --help

Run from Python script

from openpredict import openpredict_api

port = 8808
debug = False
openpredict_api.start_api(port, debug)

Access the Swagger UI at http://localhost:8808

Run by default in production, set debug = True to run in development mode.

Run with Docker

Running using Docker can be convenient of you just want to run the API without installing the package, or to run in production, alongside other services.

Clone the repository:

git clone https://github.com/MaastrichtU-IDS/translator-openpredict.git
cd translator-openpredict

Start the openpredict-api container with docker-compose 🐳

docker-compose up

Access the Swagger UI at http://localhost:8808

We use nginx-proxy and docker-letsencrypt-nginx-proxy-companion as reverse proxy for HTTP and HTTPS in production. You can change the proxy URL and port via environment variables VIRTUAL_HOST, VIRTUAL_PORT and LETSENCRYPT_HOST in the docker-compose.yml file.

Stop the container:

docker-compose down

Compute the model 🤖

Run the pipeline to compute the model used by the OpenPredict API.

From a Python script

from openpredict.openpredict_omim_drugbank import get_drug_disease_classifier

get_drug_disease_classifier()

From the command line

openpredict compute-similarities

See also 👀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openpredict-0.0.2.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

openpredict-0.0.2-py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page