# salahabdelkhabir/drgnn architecture

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

- Interactive diagram: https://gitdiagram.com/salahabdelkhabir/drgnn
- Repository: https://github.com/salahabdelkhabir/drgnn

## Overview

DRGNN is a drug-repurposing platform combining a biomedical-graph learning package with a Flask API and interactive React explorer. The user-facing workflow selects a disease, retrieves ranked drug candidates, and explores graph-based explanations and pathways. The Python package also supports graph preparation, model training, prediction, and GraphMask/meta-path interpretability. The README documents these capabilities, but sampled source does not establish how the DRGNN model is connected to the API’s data store; that integration is therefore shown as unverified.

Main entry points: [`API/src/App.tsx`](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/App.tsx) (Explorer app), [`API/drug_server/database.py`](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py) (Graph and prediction queries), [`drgnn/model.py`](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/model.py) (Heterogeneous GNN), [`API/drug_server/application.py`](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/application.py) (Flask application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Researcher interface"]
  node_app["Explorer app<br/>[App.tsx]"]
  node_sider["Disease and drug controls<br/>[index.tsx]"]
  node_scatter["Candidate scatterplot<br/>[Scatter.tsx]"]
  node_pathmatrix["Path matrix<br/>[PathMatrix.tsx]"]
  node_attention["Attention tree<br/>[AttentionTree.tsx]"]
  node_graphview["Graph view<br/>[Graph.tsx]"]
end

subgraph group_service["Exploration API"]
  node_apiapp["Flask application<br/>[application.py]"]
  node_routes["Prediction and explanation routes<br/>[api.py]"]
  node_store[("Graph and prediction queries<br/>[database.py]")]
  node_visualization["Visualization routes<br/>[vis.py]"]
end

subgraph group_ml["DRGNN modeling"]
  node_datacontrol["Data loading and splits<br/>[data.py]"]
  node_preprocessing["Graph preparation and evaluation<br/>[data_utils.py]"]
  node_model["Heterogeneous GNN<br/>[model.py]"]
  node_training["Pretrain and fine-tune<br/>[train.py]"]
  node_prediction["Prediction utilities<br/>[predict.py]"]
end

subgraph group_data["Biomedical graph data"]
  node_primekg[("PrimeKG knowledge graph")]
  node_pathways["Pathway explanations<br/>[database.py]"]
  node_cachedpredictions[("Cached drug predictions<br/>[database.py]")]
end

node_researcher(("Researcher"))

node_researcher -->|"uses"| node_app
node_app -->|"renders"| node_sider
node_app -->|"renders"| node_scatter
node_app -->|"renders"| node_pathmatrix
node_app -->|"renders"| node_attention
node_app -->|"renders"| node_graphview
node_sider -->|"selects candidates"| node_app
node_app -.->|"requests platform data"| node_apiapp
node_apiapp -->|"registers routes"| node_routes
node_apiapp -->|"registers routes"| node_visualization
node_routes -->|"queries"| node_store
node_store -->|"loads scores"| node_cachedpredictions
node_store -->|"builds explanations"| node_pathways
node_datacontrol -->|"creates graph splits"| node_preprocessing
node_training -->|"uses data"| node_datacontrol
node_training -->|"trains"| node_model
node_prediction -->|"uses"| node_model
node_model -->|"uses utilities"| node_preprocessing
node_primekg -.->|"provides graph data"| node_datacontrol
node_model -.->|"supplies prediction results"| node_store

click node_app "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/App.tsx"
click node_sider "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/Sider/index.tsx"
click node_scatter "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/CardContainer/Scatter.tsx"
click node_pathmatrix "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/TabContainer/PathMatrix.tsx"
click node_attention "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/TabContainer/AttentionTree.tsx"
click node_graphview "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/TabContainer/Graph.tsx"
click node_apiapp "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/application.py"
click node_routes "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/api.py"
click node_store "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py"
click node_visualization "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/vis.py"
click node_datacontrol "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/data.py"
click node_preprocessing "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/utils/data_utils.py"
click node_model "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/model.py"
click node_training "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/train.py"
click node_prediction "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/predict.py"
click node_pathways "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py"
click node_cachedpredictions "https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py"

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_app,node_sider,node_scatter,node_pathmatrix,node_attention,node_graphview toneBlue
class node_apiapp,node_routes,node_store,node_visualization toneAmber
class node_datacontrol,node_preprocessing,node_model,node_training,node_prediction toneMint
class node_primekg,node_pathways,node_cachedpredictions toneRose
class node_researcher toneIndigo
```

## Components

### Researcher interface

- [Explorer app](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/App.tsx): `API/src/App.tsx`
- [Disease and drug controls](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/Sider/index.tsx): `API/src/components/Sider/index.tsx`
- [Candidate scatterplot](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/CardContainer/Scatter.tsx): `API/src/components/CardContainer/Scatter.tsx`
- [Path matrix](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/TabContainer/PathMatrix.tsx): `API/src/components/TabContainer/PathMatrix.tsx`
- [Attention tree](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/TabContainer/AttentionTree.tsx): `API/src/components/TabContainer/AttentionTree.tsx`
- [Graph view](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/src/components/TabContainer/Graph.tsx): `API/src/components/TabContainer/Graph.tsx`

### Exploration API

- [Flask application](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/application.py): `API/drug_server/application.py`
- [Prediction and explanation routes](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/api.py): `API/drug_server/api.py`
- [Graph and prediction queries](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py): `API/drug_server/database.py`
- [Visualization routes](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/vis.py): `API/drug_server/vis.py`

### DRGNN modeling

- [Data loading and splits](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/data.py): `drgnn/data.py`
- [Graph preparation and evaluation](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/utils/data_utils.py): `drgnn/utils/data_utils.py`
- [Heterogeneous GNN](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/model.py): `drgnn/model.py`
- [Pretrain and fine-tune](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/train.py): `drgnn/train.py`
- [Prediction utilities](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/drgnn/predict.py): `drgnn/predict.py`

### Biomedical graph data

- **PrimeKG knowledge graph**
- [Pathway explanations](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py): `API/drug_server/database.py`
- [Cached drug predictions](https://github.com/salahabdelkhabir/drgnn/blob/DRGNN/API/drug_server/database.py): `API/drug_server/database.py`

### Other components

- **Researcher**

## Connections

- Researcher → Explorer app: uses (evidence: `README.md`)
- Explorer app → Disease and drug controls: renders (evidence: `API/src/App.tsx`)
- Explorer app → Candidate scatterplot: renders (evidence: `API/src/App.tsx`)
- Explorer app → Path matrix: renders (evidence: `API/src/App.tsx`)
- Explorer app → Attention tree: renders (evidence: `API/src/App.tsx`)
- Explorer app → Graph view: renders (evidence: `API/src/App.tsx`)
- Disease and drug controls → Explorer app: selects candidates (evidence: `API/src/components/Sider/index.tsx`)
- Explorer app → Flask application: requests platform data
- Flask application → Prediction and explanation routes: registers routes (evidence: `API/drug_server/application.py`)
- Flask application → Visualization routes: registers routes (evidence: `API/drug_server/application.py`)
- Prediction and explanation routes → Graph and prediction queries: queries (evidence: `API/drug_server/api.py`)
- Graph and prediction queries → Cached drug predictions: loads scores (evidence: `API/drug_server/database.py`)
- Graph and prediction queries → Pathway explanations: builds explanations (evidence: `API/drug_server/database.py`)
- Data loading and splits → Graph preparation and evaluation: creates graph splits (evidence: `drgnn/data.py`)
- Pretrain and fine-tune → Data loading and splits: uses data (evidence: `drgnn/train.py`)
- Pretrain and fine-tune → Heterogeneous GNN: trains (evidence: `drgnn/train.py`)
- Prediction utilities → Heterogeneous GNN: uses (evidence: `drgnn/predict.py`)
- Heterogeneous GNN → Graph preparation and evaluation: uses utilities (evidence: `drgnn/model.py`)
- PrimeKG knowledge graph → Data loading and splits: provides graph data
- Heterogeneous GNN → Graph and prediction queries: supplies prediction results
