A visual universe of drugs β explore structures, therapeutic areas, drug genealogy, and disease hierarchies at a glance.
Problem: Drug databases are fragmented, require logins, and hide structures behind captchas. It's hard to see how drugs relate across generations or therapeutic areas.
Solution: An interactive human body atlas showing all approved small-molecule drugs, with deep-linkable drug detail pages, zoomable genealogy trees, and ATC-aware disease navigation.
- πΊοΈ Central Body Atlas - Interactive human body with clickable organs and floating ATC tags
- 𧬠Structure Viewer - Instant 2D molecular visualization via RDKit.js
- π§ Route-Aware Drug Detail Pages - Open any drug as a deep-linkable
#drug/{id}detail surface with browser-back support - π³ Drug Genealogy - See how drugs evolved across generations (parent drugs β successors)
- π¦ Disease Navigation - Browse drugs by an ATC-aware disease hierarchy that prunes empty branches from the visible tree
- π Dual Display Modes - Public (simplified) and Scientist (detailed) views
- π Genealogy Zoom Controls - Zoom in, zoom out, and reset the lineage tree in scientist detail views
- 7,359 Small-Molecule Drugs from ChEMBL, KEGG, DrugBank, and FDA sources
- 55.4% ATC Coverage (4,079 drugs with valid ATC codes, 3,280 awaiting enrichment)
- 14 ATC Level 1 Categories with color-coded navigation
- 14 Body Regions mapped to therapeutic areas
- Drug Families - Group related drugs by mechanism/target
- Drug Lineages - Track evolutionary relationships
- Drug Targets - Protein target lookup with disease associations
- Graph Knowledge Engine - Unified drug-disease-target graph with evidence
- Source Provenance - Track where each drug's data originated
- Canonical Root Data Files - frontend embeds are generated from repo-root datasets
# Clone
git clone https://github.com/chenDeepin/DrugTree.git
cd DrugTree
# Start frontend (static server with generated gzip/Brotli sidecar support)
python3 scripts/serve_frontend.py --port 8080 --host 127.0.0.1
# Open in browser
open http://127.0.0.1:8080
# Optional backend (FastAPI + SQLite)
uvicorn src.backend.main:app --reload --port 8000
# Frontend regression tests
npx playwright test --config tests/frontend/playwright.config.ts
# Frontend data integration checks
node tests/frontend/e2e/disease-universe.mjsTest harness note:
tests/frontend/playwright.config.tsserves the frontend onhttp://localhost:8766to avoid collisions with a backend/API service on8765.
Important:
http://127.0.0.1:8000/is the API service, not the atlas UI. Open the static frontend URL (http://127.0.0.1:8080/) to review the body map and drug data in a browser.
Generated embed note:
scripts/build_frontend_embeds.pywrites frontend embeds plus.gzand.brsidecars.scripts/serve_frontend.pyserves the precompressed sidecars when the browser advertises support.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Topbar (Glassmorphism) β
β [DrugTree] [Search...] [Clear] [Public/Scientist] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Atlas Hero Section β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β [N] βββ βββββββββββββββ βββ [S] β β
β β [R] ββ β Human β ββ [C] β β
β β [L] ββ β Body β ββ [B] β β
β β [M] ββ β (Glow) β ββ [D] β β
β β [P] ββ βββββββββββββββ ββ [G] β β
β β [A] ββ ββ [H] β β
β β [J] ββ ββ [V] β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Active Filters: [ATC: C β] [Search: statin β] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Route-aware Detail: /#drug/atorvastatin β
β Deep-linkable detail page with structure + genealogy β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Matching Drugs (X results) β
β βββββββ βββββββ βββββββ βββββββ βββββββ β
β βDrug1β βDrug2β βDrug3β βDrug4β βDrug5β ... β
β βββββββ βββββββ βββββββ βββββββ βββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
DrugTree/
βββ data/
β βββ drugs.json # canonical drug database (7,359 drugs)
β βββ diseases.json # disease hierarchy (50 diseases)
β βββ disease_drug_edges.json # disease-drug relationships
β βββ ontology/body-ontology.json # body region definitions
β βββ processed/ # derived data (families, lineages)
β βββ curated/ # manual overrides
β βββ seeds/ # seed data for ETL
β βββ changes/ # change-log entries
βββ scripts/
β βββ build_frontend_embeds.py # regenerate frontend data embeds
βββ src/
β βββ frontend/ # Vanilla JS web app
β β βββ index.html # Entry point
β β βββ css/style.css # Dark atlas theme
β β βββ assets/ # SVG body atlas
β β βββ js/
β β β βββ app.js # DrugTreeApp class
β β β βββ app-state.js # State management helpers
β β β βββ structure.js # RDKit.js molecule viewer
β β β βββ components/ # UI components
β β β βββ stores/ # State stores
β β β βββ views/ # View renderers
β β βββ data/ # generated mirrors/embeds
β βββ backend/ # FastAPI + SQLite service
β βββ main.py # Entry point
β βββ run_etl.sh # ETL pipeline launcher
β βββ routers/ # API route modules (drugs, diseases, targets, graph, admin)
β βββ models/ # Pydantic & DB models
β βββ services/ # Business logic & graph engine
β βββ etl/ # drug / disease / ATC / target pipelines
β βββ db/ # SQLite connection & schema
β βββ migrations/ # SQL migrations
β βββ cache/ # API response caching
β βββ export/ # Data exporters
β βββ validation/ # Migration & data validators
βββ tests/
βββ backend/ # pytest suites
βββ frontend/ # Playwright e2e + Node tests
βββ e2e/p0-regression.spec.ts # route/detail/disease high-signal regressions
| Layer | Technology |
|---|---|
| Frontend | Vanilla JS + RDKit.js |
| Backend | FastAPI (Python) + SQLite |
| Data | ChEMBL + DrugBank + PubChem + KEGG + FDA |
| E2E Tests | Playwright |
| Hosting | GitHub Pages (MVP) |
| Code | Category | Color | Drugs (valid ATC) |
|---|---|---|---|
| A | Alimentary & Metabolism | Green | ~300+ |
| B | Blood & Blood-forming | Red | ~250+ |
| C | Cardiovascular | Pink | ~400+ |
| D | Dermatological | Orange | ~200+ |
| G | Genito-urinary | Purple | ~250+ |
| H | Systemic Hormones | Brown | ~150+ |
| J | Anti-infectives | Blue | ~800+ |
| L | Antineoplastic | Dark Red | ~600+ |
| M | Musculo-skeletal | Grey | ~200+ |
| N | Nervous System | Deep Purple | ~700+ |
| P | Antiparasitic | Teal | ~100+ |
| R | Respiratory | Cyan | ~300+ |
| S | Sensory Organs | Indigo | ~150+ |
| V | Various | Grey | ~3,097 (many need re-classification) |
Note: Exact counts vary as ATC enrichment continues. See
/data/drugs.jsonfor current state.
{
"id": "atorvastatin",
"name": "atorvastatin",
"smiles": "CC(C)OC(=O)C(C)(C)Oc1ccc(C(=O)c2ccc(Cl)cc2)cc1",
"inchikey": "YMTINGFKWWXKFG-UHFFFAOYSA-N",
"atc_code": "C10AA05",
"atc_category": "C",
"molecular_weight": 360.84,
"phase": "IV",
"year_approved": null,
"generation": 1,
"indication": "approved",
"targets": [],
"company": null,
"synonyms": [],
"class": null,
"body_region": "blood_immune",
"secondary_body_regions": ["eye_ear", "heart_vascular", "kidney_urinary", "liver_biliary_pancreas"],
"chembl_id": "CHEMBL1487",
"kegg_id": "D00565",
"clinical_trials": ["NCT00504829", "NCT00362323"]
}{
"family_id": "target_hmg_coa_reductase_7169b791",
"label": "Hmg Coa Reductase Target Family",
"family_basis": "target",
"prototype_drug_id": "atorvastatin",
"member_drug_ids": ["atorvastatin", "simvastatin", "lovastatin", "pravastatin"],
"representative_target_ids": ["HMG-CoA reductase"],
"description": "Drugs targeting hmg coa reductase",
"atc_codes": ["C10AA05", "C10AA01", "C10AA02", "C10AA03"]
}{
"edge_id": "omeprazole_to_lansoprazole",
"from_drug_id": "omeprazole",
"to_drug_id": "lansoprazole",
"edge_type": "follow_on",
"confidence": 0.843,
"rationale_tags": [],
"score_breakdown": {
"chronology_score": 1.0,
"mechanism_score": 1.0,
"scaffold_score": 0.478
},
"provenance": "auto",
"explanation": "Lansoprazole (1995) derived from Omeprazole (1989) | scores: chronology=1.0, mechanism=1.0, scaffold=0.48"
}All endpoints are prefixed with /api/v1.
| Endpoint | Method | Description |
|---|---|---|
/api/v1/drugs |
GET | List all drugs (with pagination, filters: category, search, phase) |
/api/v1/drugs/{id} |
GET | Get drug by ID |
/api/v1/drugs/search |
GET | Search drugs by name, target, class, or synonyms (?q=query&limit=100&offset=0) |
/api/v1/drugs/category/{category} |
GET | Filter drugs by ATC category (A-V, with limit/offset) |
/api/v1/families |
GET | List drug families (limit/offset, limit capped at 1000) |
/api/v1/families/{family_id} |
GET | Get family by ID |
/api/v1/lineages |
GET | List lineage edges (filters: drug_id, edge_type, plus limit/offset, limit capped at 1000) |
/api/v1/lineage/{drug_id} |
GET | Get genealogy tree for a drug (with threshold param) |
/api/v1/regions |
GET | List all body regions from ontology |
/api/v1/tree/disease/{disease_id} |
GET | Get body region and paginated drugs for a disease (limit/offset, limit capped at 100; response includes total) |
/api/v1/graph/stats |
GET | Get graph index statistics |
/api/v1/graph/node/{node_id} |
GET | Get graph node by namespaced ID |
/api/v1/graph/neighborhood/{node_id} |
GET | N-hop neighborhood (?max_hops=1-5) |
/api/v1/graph/evidence/{edge_id} |
GET | Evidence supporting a graph edge |
/api/v1/graph/subgraph |
GET | Subgraph extraction (?node_ids=a,b,c) |
/api/v1/diseases |
GET | List disease hierarchy (with pagination) |
/api/v1/diseases/{id} |
GET | Get disease by ID |
/api/v1/diseases/search/{query} |
GET | Search diseases by name, synonym, or mechanism (with limit/offset) |
/api/v1/diseases/region/{region} |
GET | List diseases in a body region (with limit/offset) |
/api/v1/diseases/{id}/drugs |
GET | Get drugs for a disease (with limit/offset) |
/api/v1/admin/health/data-quality |
GET | Data quality health check |
/api/v1/admin/refresh |
POST | Refresh runtime snapshot, graph index, and graph query caches |
/api/v1/targets |
GET | List all drug targets (with pagination) |
/api/v1/targets/{target_id} |
GET | Get target detail by ID |
- Project Plan β Full architecture and roadmap
- Central Body Atlas Implementation β Atlas design
- Data Update Workflow β ETL pipeline documentation
MIT
Built by chenDeepin π―