# sahilparanjpe/drug-to-drug-interaction-prediction architecture

> Architecture diagram of the GitHub repository sahilparanjpe/drug-to-drug-interaction-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahilparanjpe/drug-to-drug-interaction-prediction
- Repository: https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction

## Overview

This repository provides a hierarchical drug–drug interaction prediction engine through a Streamlit dashboard, a standalone Python pipeline, and a documented interactive notebook. The main workflow resolves medicine names, obtains molecular records, builds drug-pair fingerprints, predicts PK/PD interaction types with calibrated SVM and Random Forest models, verifies known interactions, then produces confidence-ranked clinical risk reports. The graph separates the dashboard, pipeline stages, model training/artifacts, and benchmark data. The notebook is documented but its contents were not sampled; model-loading details and some pipeline internals are likewise not fully shown.

Main entry points: [`app.py`](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/app.py) (Streamlit dashboard), [`ddi_pipeline.py`](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py) (Pipeline orchestrator), [`models`](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/models) (PK/PD classifiers), [`train_models.py`](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/train_models.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_notebook["Interactive notebook<br/>[svm_rf.ipynb]"]
  node_cli["Pipeline CLI<br/>[ddi_pipeline.py]"]
  node_report["Clinical report<br/>[app.py]"]
end

subgraph group_pipeline["Prediction pipeline"]
  node_orchestrator["Pipeline orchestrator<br/>[ddi_pipeline.py]"]
  node_validation["Medicine validation<br/>[ddi_pipeline.py]"]
  node_molecular["Molecular retrieval<br/>[ddi_pipeline.py]"]
  node_representation["Molecule representation<br/>[ddi_pipeline.py]"]
  node_pairing["Drug pair generation<br/>[ddi_pipeline.py]"]
  node_features["Fingerprint features<br/>[ddi_pipeline.py]"]
  node_interpretation["Interaction interpretation<br/>[ddi_pipeline.py]"]
  node_risk["Risk ranking<br/>[ddi_pipeline.py]"]
end

subgraph group_models["Models and knowledge"]
  node_classification["PK/PD classifiers"]
  node_lookup[("Known DDI lookup")]
  node_training["Model training<br/>[train_models.py]"]
  node_artifacts[("Serialized models")]
end

subgraph group_data["Drug and benchmark data"]
  node_drugdata[("Drug registry data")]
  node_vocabulary[("Drug vocabulary")]
  node_benchmark[("DDI benchmark pairs")]
end

node_clinician(("Clinician"))

node_clinician -->|"enters regimen"| node_dashboard
node_clinician -->|"runs analysis"| node_notebook
node_clinician -->|"runs pipeline"| node_cli
node_dashboard -->|"loads engine"| node_orchestrator
node_dashboard -->|"validates inputs"| node_validation
node_dashboard -->|"retrieves records"| node_molecular
node_dashboard -->|"represents molecules"| node_representation
node_dashboard -->|"generates pairs"| node_pairing
node_dashboard -->|"extracts features"| node_features
node_dashboard -->|"applies models"| node_classification
node_dashboard -->|"predicts interactions"| node_interpretation
node_dashboard -->|"ranks results"| node_risk
node_risk -->|"supplies ranked results"| node_report
node_orchestrator -->|"validates"| node_validation
node_orchestrator -->|"retrieves"| node_molecular
node_orchestrator -->|"represents"| node_representation
node_orchestrator -->|"generates pairs"| node_pairing
node_orchestrator -->|"extracts features"| node_features
node_orchestrator -->|"applies classifiers"| node_classification
node_orchestrator -->|"predicts type"| node_interpretation
node_orchestrator -->|"sorts results"| node_risk
node_validation -->|"resolves drug IDs"| node_drugdata
node_validation -->|"resolves names"| node_vocabulary
node_molecular -->|"reads SMILES"| node_drugdata
node_features -->|"supplies pair features"| node_classification
node_classification -->|"checks known pairs"| node_lookup
node_training -->|"reads SMILES"| node_drugdata
node_training -->|"trains from pairs"| node_benchmark
node_training -->|"saves models"| node_artifacts
node_classification -->|"uses trained models"| node_artifacts
node_orchestrator -.->|"loads model assets"| node_artifacts

click node_dashboard "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/app.py"
click node_notebook "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/svm_rf.ipynb"
click node_cli "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_orchestrator "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_validation "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_molecular "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_representation "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_pairing "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_features "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_classification "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/models"
click node_lookup "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/models/known_lookup.joblib"
click node_interpretation "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_risk "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py"
click node_report "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/app.py"
click node_training "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/train_models.py"
click node_drugdata "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/Final_Canonical_Full_DrugBank_SMILES.csv"
click node_vocabulary "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/drugbank%20vocabulary%20(1).csv"
click node_benchmark "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/DDI-HierPred_Dataset"
click node_artifacts "https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/models"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_notebook,node_cli,node_report toneBlue
class node_orchestrator,node_validation,node_molecular,node_representation,node_pairing,node_features,node_interpretation,node_risk toneAmber
class node_classification,node_lookup,node_training,node_artifacts toneMint
class node_drugdata,node_vocabulary,node_benchmark toneRose
class node_clinician toneIndigo
```

## Components

### User interfaces

- [Streamlit dashboard](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/app.py): `app.py`
- [Interactive notebook](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/svm_rf.ipynb): `svm_rf.ipynb`
- [Pipeline CLI](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Clinical report](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/app.py): `app.py`

### Prediction pipeline

- [Pipeline orchestrator](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Medicine validation](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Molecular retrieval](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Molecule representation](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Drug pair generation](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Fingerprint features](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Interaction interpretation](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`
- [Risk ranking](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/ddi_pipeline.py): `ddi_pipeline.py`

### Models and knowledge

- [PK/PD classifiers](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/models): `models`
- [Known DDI lookup](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/models/known_lookup.joblib): `models/known_lookup.joblib`
- [Model training](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/train_models.py): `train_models.py`
- [Serialized models](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/models): `models`

### Drug and benchmark data

- [Drug registry data](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/Final_Canonical_Full_DrugBank_SMILES.csv): `Final_Canonical_Full_DrugBank_SMILES.csv`
- [Drug vocabulary](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/blob/main/drugbank%20vocabulary%20(1).csv): `drugbank vocabulary (1).csv`
- [DDI benchmark pairs](https://github.com/sahilparanjpe/drug-to-drug-interaction-prediction/tree/main/DDI-HierPred_Dataset): `DDI-HierPred_Dataset`

### Other components

- **Clinician**

## Connections

- Clinician → Streamlit dashboard: enters regimen (evidence: `README.md`)
- Clinician → Interactive notebook: runs analysis (evidence: `README.md`)
- Clinician → Pipeline CLI: runs pipeline (evidence: `README.md`)
- Streamlit dashboard → Pipeline orchestrator: loads engine (evidence: `app.py`)
- Streamlit dashboard → Medicine validation: validates inputs (evidence: `app.py`)
- Streamlit dashboard → Molecular retrieval: retrieves records (evidence: `app.py`)
- Streamlit dashboard → Molecule representation: represents molecules (evidence: `app.py`)
- Streamlit dashboard → Drug pair generation: generates pairs (evidence: `app.py`)
- Streamlit dashboard → Fingerprint features: extracts features (evidence: `app.py`)
- Streamlit dashboard → PK/PD classifiers: applies models (evidence: `app.py`)
- Streamlit dashboard → Interaction interpretation: predicts interactions (evidence: `app.py`)
- Streamlit dashboard → Risk ranking: ranks results (evidence: `app.py`)
- Risk ranking → Clinical report: supplies ranked results (evidence: `app.py`)
- Pipeline orchestrator → Medicine validation: validates (evidence: `ddi_pipeline.py`)
- Pipeline orchestrator → Molecular retrieval: retrieves (evidence: `ddi_pipeline.py`)
- Pipeline orchestrator → Molecule representation: represents (evidence: `ddi_pipeline.py`)
- Pipeline orchestrator → Drug pair generation: generates pairs (evidence: `ddi_pipeline.py`)
- Pipeline orchestrator → Fingerprint features: extracts features (evidence: `README.md`)
- Pipeline orchestrator → PK/PD classifiers: applies classifiers (evidence: `README.md`)
- Pipeline orchestrator → Interaction interpretation: predicts type (evidence: `README.md`)
- Pipeline orchestrator → Risk ranking: sorts results (evidence: `README.md`)
- Medicine validation → Drug registry data: resolves drug IDs (evidence: `ddi_pipeline.py`)
- Medicine validation → Drug vocabulary: resolves names (evidence: `ddi_pipeline.py`)
- Molecular retrieval → Drug registry data: reads SMILES (evidence: `ddi_pipeline.py`)
- Fingerprint features → PK/PD classifiers: supplies pair features (evidence: `ddi_pipeline.py`)
- PK/PD classifiers → Known DDI lookup: checks known pairs
- Model training → Drug registry data: reads SMILES (evidence: `train_models.py`)
- Model training → DDI benchmark pairs: trains from pairs (evidence: `train_models.py`)
- Model training → Serialized models: saves models (evidence: `train_models.py`)
- PK/PD classifiers → Serialized models: uses trained models (evidence: `README.md`)
- Pipeline orchestrator → Serialized models: loads model assets
