AI/ML API¶
Prerequisites¶
Before proceeding with the installation or deployment of the AI/ML API, ensure you have the following prerequisites:
- Python 3.9
- Anaconda
PipelineAlternative_clinicaldata
data- PBPK (Physiologically Based Pharmacokinetic) data
- cddd (Compound Database for Drug Discovery) data
Installation¶
Clone the Repository¶
Prepare Data Directories¶
Place the required data directories in their respective locations:
PipelineAlternative_clinicaldata
models
directorycddd
directories insidePipelineAlternative_clinicaldata
PBPK
directory insidemodels
Copy the contents of the patches
directory into the models
directory:
Set up Virtual Environments¶
cddd Environment¶
Create and activate a virtual environment for cddd
:
cd cddd
conda env create -f environment.yml
conda activate cddd
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.10.0-cp36-cp36m-linux_x86_64.whl
pip install -e .
conda deactivate
Alternative Environment¶
Create and activate the alternative
virtual environment:
Install dependencies from the requirements file:
Start the Server¶
Launch the API server by running:
Installation with Docker¶
Build and run the AI/ML API container using Docker:
-
Build the image:
-
Run the container:
Deployment in Kubernetes¶
Update and apply the deployment files located in the deployment/kubernetes
directory:
For authentication, use Istio with a custom Envoy filter. Follow the instructions provided in the envoy-filter documentation.
API Usage¶
Endpoints¶
ML Evaluation¶
curl -X POST -H "Content-Type: application/json" -d '{"smiles": "c1ccccc1O"}' https://ai-ml-api.platform.alternative-project.eu/clinicaldata/ml/evaluate -o results.csv
AI Evaluation¶
curl -X POST -H "Content-Type: application/json" -d '{"smiles": "c1ccccc1O"}' https://ai-ml-api.platform.alternative-project.eu/clinicaldata/ai/evaluate
AOP (Alternate Operating Procedure) Evaluation¶
curl -X POST -H "Content-Type: application/json" -d '{"smiles": "c1ccccc1O"}' https://ai-ml-api.platform.alternative-project.eu/clinicaldata/aop/evaluate
Doxorubicin PBPK Model¶
curl -X POST https://ai-ml-api.platform.alternative-project.eu/pbpk/doxorubicin -H "Content-Type: application/json" -d '{"dose_mg": 60, "age": 50, "weight": 70, "height": 190}'
HTTK (Human Toxicology Toolkit) Model¶
curl -X POST https://ai-ml-api.platform.alternative-project.eu/pbpk/httk -H "Content-Type: application/json" -d '{"chem_name": "Bisphenol A", "species": "human", "daily_dose": 1, "doses_per_day": 1, "days": 15}'
IsAlive Check¶
Verify if the server is alive:
Testing¶
To run unit tests, use the following command: