Spaces:
Sleeping
Sleeping
Vasumathi Varadararajan commited on
Commit ·
2de7ca3
1
Parent(s): 684a727
ClinSift: app, UI, and aggregate data
Browse files- .gitattributes +0 -35
- .gitignore +6 -0
- Dockerfile +16 -0
- README.md +74 -6
- app.py +371 -0
- data/crossreactivity_similarity.json +749 -0
- data/sideeffect_cohesion.json +936 -0
- requirements.txt +8 -0
- ssiddi_model.py +103 -0
- ui.html +434 -0
.gitattributes
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gitignore
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEVER commit patient-level MIMIC-derived data to a public repo (PhysioNet DUA).
|
| 2 |
+
data/patient_allergies.json
|
| 3 |
+
data/patient_crossreactivity_refined.json
|
| 4 |
+
data_private/
|
| 5 |
+
*.env
|
| 6 |
+
__pycache__/
|
Dockerfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
# rdkit drawing needs a couple of system libs
|
| 6 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
+
libxrender1 libxext6 && rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
COPY requirements.txt .
|
| 10 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
+
|
| 12 |
+
COPY . .
|
| 13 |
+
|
| 14 |
+
# HuggingFace Spaces expects the app on port 7860
|
| 15 |
+
EXPOSE 7860
|
| 16 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -1,12 +1,80 @@
|
|
| 1 |
---
|
| 2 |
title: ClinSift
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: false
|
| 8 |
-
license: apache-2.0
|
| 9 |
-
short_description: Real-world drug-safety filter
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: ClinSift
|
| 3 |
+
emoji: 🧪
|
| 4 |
+
colorFrom: teal
|
| 5 |
+
colorTo: gray
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# ClinSift — real-world drug-safety filter
|
| 12 |
+
|
| 13 |
+
Screens a drug or a novel compound against adverse-event signals and returns a
|
| 14 |
+
single **gate decision** (PASS / FLAG / HOLD) for a drug-development pipeline.
|
| 15 |
+
The UI and the API are one deployment: open the Space and it talks to its own backend.
|
| 16 |
+
|
| 17 |
+
- **Known drug** → observed cross-reactivity & class side-effects (from EHR-derived signals)
|
| 18 |
+
- **Novel compound (SMILES)** → SSI-DDI interaction prediction + **substructure attribution**
|
| 19 |
+
(which atoms drive the interaction) + nearest known drugs via MoLFormer-XL
|
| 20 |
+
- Every response is also a JSON contract a pipeline can gate on programmatically
|
| 21 |
+
|
| 22 |
+
The interaction model is a proof-of-concept (SSI-DDI, ~0.79 AUC on a public
|
| 23 |
+
BIOSNAP subset). Outputs are predictions, not clinical advice.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## ⚠️ DATA-USE COMPLIANCE — read before making this public
|
| 28 |
+
|
| 29 |
+
This public build ships **only** non-patient artifacts:
|
| 30 |
+
`molformer_embeddings.npz`, `ssiddi_best.pth`, and the aggregate
|
| 31 |
+
`crossreactivity_similarity.json` / `sideeffect_cohesion.json` (population-level,
|
| 32 |
+
no patient identifiers).
|
| 33 |
+
|
| 34 |
+
It **excludes** the patient-level MIMIC-derived files
|
| 35 |
+
(`patient_allergies.json`, `patient_crossreactivity_refined.json`, which contain
|
| 36 |
+
note IDs). MIMIC's PhysioNet Data Use Agreement **prohibits public redistribution**
|
| 37 |
+
of patient-level derivatives. `.gitignore` blocks these from being committed.
|
| 38 |
+
|
| 39 |
+
- **Public Space:** leave those files out. Allergy cross-reactivity shows
|
| 40 |
+
"requires patient data" — that is correct and expected.
|
| 41 |
+
- **Private Space (only if your DUA permits):** set the Space to *private*, then
|
| 42 |
+
add the two files to `data/`. Confirm with your PhysioNet DUA / data steward first.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
## Run locally
|
| 47 |
+
```bash
|
| 48 |
+
pip install -r requirements.txt
|
| 49 |
+
uvicorn app:app --port 8000
|
| 50 |
+
# open http://localhost:8000
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## Deploy to your HuggingFace account
|
| 54 |
+
You run these (they need your HF login; never share your token):
|
| 55 |
+
```bash
|
| 56 |
+
pip install huggingface_hub
|
| 57 |
+
huggingface-cli login # paste your WRITE token when prompted
|
| 58 |
+
|
| 59 |
+
# create a Docker Space under your account
|
| 60 |
+
huggingface-cli repo create clinsift --type space --space_sdk docker
|
| 61 |
+
|
| 62 |
+
# push this folder
|
| 63 |
+
git init && git lfs install
|
| 64 |
+
git lfs track "*.npz" "*.pth"
|
| 65 |
+
git add .gitignore .gitattributes
|
| 66 |
+
git add Dockerfile requirements.txt README.md app.py ssiddi_model.py ui.html data/
|
| 67 |
+
git commit -m "ClinSift: real-world drug-safety filter"
|
| 68 |
+
git remote add origin https://huggingface.co/spaces/<your-username>/clinsift
|
| 69 |
+
git push origin main
|
| 70 |
+
```
|
| 71 |
+
Large files (`.npz`, `.pth`) go through Git LFS — the `git lfs track` step above
|
| 72 |
+
handles that. First screen of a SMILES downloads MoLFormer-XL (~200 MB) once.
|
| 73 |
+
|
| 74 |
+
## API
|
| 75 |
+
```
|
| 76 |
+
GET /health
|
| 77 |
+
POST /screen {"drug":"penicillin"}
|
| 78 |
+
POST /screen {"drug_a":"warfarin","drug_b":"clopidogrel"}
|
| 79 |
+
POST /screen_smiles {"smiles":"CC1=C(...)","name":"CWR-001"}
|
| 80 |
+
```
|
app.py
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Sentinel backend — real-world drug-safety screening API.
|
| 3 |
+
|
| 4 |
+
Serves the actual pipeline outputs (EHR-derived signals) for KNOWN drugs, and
|
| 5 |
+
runs the trained models live for NOVEL compounds:
|
| 6 |
+
- SSI-DDI (uploaded checkpoint) -> drug-drug interaction + substructure attribution
|
| 7 |
+
- MoLFormer-XL (loaded at runtime) -> structural similarity to 380 known drugs,
|
| 8 |
+
bridged to their observed EHR reactions (the real-world-evidence layer)
|
| 9 |
+
|
| 10 |
+
Endpoints:
|
| 11 |
+
GET /health
|
| 12 |
+
POST /screen {drug} | {drug_a, drug_b} -> observed evidence (known drugs)
|
| 13 |
+
POST /screen_smiles {smiles, name?} -> predicted signals (novel compound)
|
| 14 |
+
"""
|
| 15 |
+
import os, json, numpy as np, torch, warnings
|
| 16 |
+
from functools import lru_cache
|
| 17 |
+
from fastapi import FastAPI
|
| 18 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 19 |
+
from pydantic import BaseModel
|
| 20 |
+
from ssiddi_model import load_ssiddi, smiles_to_graph
|
| 21 |
+
from torch_geometric.data import Batch
|
| 22 |
+
from rdkit import Chem
|
| 23 |
+
from rdkit.Chem.Draw import rdMolDraw2D
|
| 24 |
+
warnings.filterwarnings("ignore")
|
| 25 |
+
|
| 26 |
+
DATA = os.path.join(os.path.dirname(__file__), "data")
|
| 27 |
+
DEVICE = "cpu"
|
| 28 |
+
|
| 29 |
+
# ---------------------------------------------------------------- SMILES map
|
| 30 |
+
# canonical SMILES for drugs that appear in the vocab / demos, so DDI (SSI-DDI)
|
| 31 |
+
# runs for named pairs. Novel compounds bring their own SMILES.
|
| 32 |
+
SMILES = {
|
| 33 |
+
"warfarin":"CC(=O)CC(c1ccccc1)C1=C(O)c2ccccc2OC1=O","coumadin":"CC(=O)CC(c1ccccc1)C1=C(O)c2ccccc2OC1=O",
|
| 34 |
+
"aspirin":"CC(=O)Oc1ccccc1C(=O)O","asa":"CC(=O)Oc1ccccc1C(=O)O",
|
| 35 |
+
"penicillin":"CC1(C)SC2C(NC(=O)Cc3ccccc3)C(=O)N2C1C(=O)O","penicillins":"CC1(C)SC2C(NC(=O)Cc3ccccc3)C(=O)N2C1C(=O)O",
|
| 36 |
+
"amoxicillin":"CC1(C)SC2C(NC(=O)C(N)c3ccc(O)cc3)C(=O)N2C1C(=O)O",
|
| 37 |
+
"cephalexin":"CC1=C(C(=O)O)N2C(=O)C(NC(=O)C(N)c3ccccc3)C2SC1","keflex":"CC1=C(C(=O)O)N2C(=O)C(NC(=O)C(N)c3ccccc3)C2SC1",
|
| 38 |
+
"ciprofloxacin":"OC(=O)C1=CN(C2CC2)c2cc(N3CCNCC3)c(F)cc2C1=O","cipro":"OC(=O)C1=CN(C2CC2)c2cc(N3CCNCC3)c(F)cc2C1=O",
|
| 39 |
+
"simvastatin":"CCC(C)(C)C(=O)OC1CC(C)C=C2C=CC(C)C(CCC3CC(O)CC(=O)O3)C12",
|
| 40 |
+
"atorvastatin":"CC(C)c1c(C(=O)Nc2ccccc2)c(-c2ccccc2)c(-c2ccc(F)cc2)n1CCC(O)CC(O)CC(=O)O",
|
| 41 |
+
"lipitor":"CC(C)c1c(C(=O)Nc2ccccc2)c(-c2ccccc2)c(-c2ccc(F)cc2)n1CCC(O)CC(O)CC(=O)O",
|
| 42 |
+
"metoprolol":"CC(C)NCC(O)COc1ccc(CCOC)cc1","atenolol":"CC(C)NCC(O)COc1ccc(CC(N)=O)cc1",
|
| 43 |
+
"labetalol":"CC(CCc1ccccc1)NCC(O)c1ccc(O)c(C(N)=O)c1","carvedilol":"COc1ccccc1OCCNCC(O)COc1cccc2[nH]c3ccccc3c12",
|
| 44 |
+
"imatinib":"Cc1ccc(NC(=O)c2ccc(CN3CCN(C)CC3)cc2)cc1Nc1nccc(-c2cccnc2)n1",
|
| 45 |
+
"dasatinib":"Cc1nc(Nc2ncc(C(=O)Nc3c(C)cccc3Cl)s2)cc(N2CCN(CCO)CC2)n1",
|
| 46 |
+
"metformin":"CN(C)C(=N)NC(N)=N","clopidogrel":"COC(=O)C(c1ccccc1Cl)N1CCc2sccc2C1","plavix":"COC(=O)C(c1ccccc1Cl)N1CCc2sccc2C1",
|
| 47 |
+
"ibuprofen":"CC(C)Cc1ccc(C(C)C(=O)O)cc1","naproxen":"COc1ccc2cc(C(C)C(=O)O)ccc2c1",
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
# ---------------------------------------------------------------- load data
|
| 51 |
+
print("[clinsift] loading pipeline data ...")
|
| 52 |
+
_emb = np.load(os.path.join(DATA, "molformer_embeddings.npz"))
|
| 53 |
+
EMB = {k: _emb[k].astype(np.float32) for k in _emb.keys()}
|
| 54 |
+
EMB_KEYS = list(EMB.keys())
|
| 55 |
+
EMB_MAT = np.stack([EMB[k] for k in EMB_KEYS])
|
| 56 |
+
EMB_NORM = EMB_MAT / (np.linalg.norm(EMB_MAT, axis=1, keepdims=True) + 1e-9)
|
| 57 |
+
|
| 58 |
+
def _load(fn, default):
|
| 59 |
+
p = os.path.join(DATA, fn)
|
| 60 |
+
try:
|
| 61 |
+
return json.load(open(p))
|
| 62 |
+
except FileNotFoundError:
|
| 63 |
+
print(f"[clinsift] {fn} not present — related signals disabled (expected for public build)")
|
| 64 |
+
return default
|
| 65 |
+
|
| 66 |
+
XR = _load("crossreactivity_similarity.json", [])
|
| 67 |
+
SE = _load("sideeffect_cohesion.json", [])
|
| 68 |
+
PA = _load("patient_allergies.json", {}) # patient-level: absent in public build
|
| 69 |
+
PCR = _load("patient_crossreactivity_refined.json", {}) # patient-level: absent in public build
|
| 70 |
+
PATIENT_DATA = bool(PA) and bool(PCR)
|
| 71 |
+
|
| 72 |
+
# indices ---------------------------------------------------------
|
| 73 |
+
IMMUNE = ["rash","hives","anaphyl","angioedema","urticaria","hypersensitiv","eruption","pruritus","allerg"]
|
| 74 |
+
def is_immune(s): return any(k in s.lower() for k in IMMUNE)
|
| 75 |
+
|
| 76 |
+
# drug -> cross-reactivity partners (observed, from EHR)
|
| 77 |
+
XR_BY_DRUG = {}
|
| 78 |
+
for r in XR:
|
| 79 |
+
for a,b in ((r["drug_a"],r["drug_b"]),(r["drug_b"],r["drug_a"])):
|
| 80 |
+
XR_BY_DRUG.setdefault(a,[]).append({"to":b,"sim":r["similarity"],"reactions":r["shared_reactions"]})
|
| 81 |
+
|
| 82 |
+
# drug -> side-effect clusters it belongs to (observed)
|
| 83 |
+
BASELINE = 0.656
|
| 84 |
+
SE_BY_DRUG = {}
|
| 85 |
+
for e in SE:
|
| 86 |
+
if is_immune(e["reaction"]): continue # immune handled as allergy
|
| 87 |
+
for d in e["drugs"]:
|
| 88 |
+
SE_BY_DRUG.setdefault(d,[]).append({"reaction":e["reaction"],"cohesion":e["cohesion"],"n":e["n_drugs"]})
|
| 89 |
+
|
| 90 |
+
# drug -> allergy cross-reactions (immune-filtered, patient-anchored)
|
| 91 |
+
ALL_BY_DRUG = {}
|
| 92 |
+
for rec in PCR.get("true_cross_reactivity", []):
|
| 93 |
+
if not is_immune(rec["reaction"]): continue
|
| 94 |
+
if rec["similarity"] < 0.70: continue
|
| 95 |
+
a, b, rx, sim = rec["known_allergen"], rec["reacted_to"], rec["reaction"], rec["similarity"]
|
| 96 |
+
ALL_BY_DRUG.setdefault(a,[]).append({"to":b,"reaction":rx,"sim":sim})
|
| 97 |
+
ALL_BY_DRUG.setdefault(b,[]).append({"to":a,"reaction":rx,"sim":sim})
|
| 98 |
+
|
| 99 |
+
# allergen prevalence (patient counts) for provenance
|
| 100 |
+
ALLERGEN_COUNT = {}
|
| 101 |
+
for v in PA.values():
|
| 102 |
+
for a in v.get("allergies", []):
|
| 103 |
+
if a and a != "___": ALLERGEN_COUNT[a] = ALLERGEN_COUNT.get(a,0)+1
|
| 104 |
+
|
| 105 |
+
print(f"[clinsift] {len(EMB_KEYS)} embeddings | {len(XR_BY_DRUG)} xreact drugs | "
|
| 106 |
+
f"{len(SE_BY_DRUG)} sidefx drugs | {len(ALL_BY_DRUG)} allergy drugs")
|
| 107 |
+
|
| 108 |
+
# ---------------------------------------------------------------- models
|
| 109 |
+
SSI = load_ssiddi(os.path.join(DATA, "ssiddi_best.pth"), DEVICE)
|
| 110 |
+
print("[clinsift] SSI-DDI checkpoint loaded")
|
| 111 |
+
|
| 112 |
+
MOLFORMER = None
|
| 113 |
+
def get_molformer():
|
| 114 |
+
"""Lazy-load MoLFormer-XL. Works where HuggingFace is reachable."""
|
| 115 |
+
global MOLFORMER
|
| 116 |
+
if MOLFORMER == "unavailable": return None
|
| 117 |
+
if MOLFORMER is not None: return MOLFORMER
|
| 118 |
+
try:
|
| 119 |
+
from transformers import AutoModel, AutoTokenizer
|
| 120 |
+
tok = AutoTokenizer.from_pretrained("ibm/MoLFormer-XL-both-10pct", trust_remote_code=True)
|
| 121 |
+
mdl = AutoModel.from_pretrained("ibm/MoLFormer-XL-both-10pct", deterministic_eval=True,
|
| 122 |
+
trust_remote_code=True).eval()
|
| 123 |
+
MOLFORMER = (tok, mdl)
|
| 124 |
+
print("[clinsift] MoLFormer-XL loaded")
|
| 125 |
+
return MOLFORMER
|
| 126 |
+
except Exception as e:
|
| 127 |
+
print(f"[clinsift] MoLFormer unavailable ({str(e)[:80]}) — novel cross-reactivity disabled in this runtime")
|
| 128 |
+
MOLFORMER = "unavailable"
|
| 129 |
+
return None
|
| 130 |
+
|
| 131 |
+
def embed_smiles(smiles):
|
| 132 |
+
m = get_molformer()
|
| 133 |
+
if m is None: return None
|
| 134 |
+
tok, mdl = m
|
| 135 |
+
with torch.no_grad():
|
| 136 |
+
inp = tok([smiles], padding=True, return_tensors="pt")
|
| 137 |
+
out = mdl(**inp)
|
| 138 |
+
return out.pooler_output[0].cpu().numpy().astype(np.float32)
|
| 139 |
+
|
| 140 |
+
def nearest_known(vec, k=6):
|
| 141 |
+
v = vec / (np.linalg.norm(vec)+1e-9)
|
| 142 |
+
sims = EMB_NORM @ v
|
| 143 |
+
idx = np.argsort(-sims)[:k]
|
| 144 |
+
return [(EMB_KEYS[i], float(sims[i])) for i in idx]
|
| 145 |
+
|
| 146 |
+
def ddi_smiles(sa, sb):
|
| 147 |
+
ga, gb = smiles_to_graph(sa), smiles_to_graph(sb)
|
| 148 |
+
if ga is None or gb is None: return None
|
| 149 |
+
with torch.no_grad():
|
| 150 |
+
return torch.sigmoid(SSI(Batch.from_data_list([ga]), Batch.from_data_list([gb]))).item()
|
| 151 |
+
|
| 152 |
+
def attribution_svg(smiles_a, smiles_b):
|
| 153 |
+
"""Heat-map the query molecule by which atoms drive the predicted interaction."""
|
| 154 |
+
attr = SSI.attribution(smiles_a, smiles_b)
|
| 155 |
+
if attr is None: return None
|
| 156 |
+
mol = Chem.MolFromSmiles(smiles_a)
|
| 157 |
+
imp = np.array(attr["a_atom_importance"], dtype=float)
|
| 158 |
+
imp = (imp - imp.min()) / (imp.max() - imp.min() + 1e-9)
|
| 159 |
+
hi, radii = {}, {}
|
| 160 |
+
for i in range(mol.GetNumAtoms()):
|
| 161 |
+
w = float(imp[i])
|
| 162 |
+
hi[i] = (1.0, 1.0-0.55*w, 0.85-0.85*w) if w > 0.15 else (0.90, 0.96, 0.95)
|
| 163 |
+
radii[i] = 0.3 + 0.35*w
|
| 164 |
+
d = rdMolDraw2D.MolDraw2DSVG(340, 250)
|
| 165 |
+
d.drawOptions().clearBackground = False
|
| 166 |
+
rdMolDraw2D.PrepareAndDrawMolecule(d, mol, highlightAtoms=list(range(mol.GetNumAtoms())),
|
| 167 |
+
highlightAtomColors=hi, highlightAtomRadii=radii)
|
| 168 |
+
d.FinishDrawing()
|
| 169 |
+
top = int(np.argmax(imp))
|
| 170 |
+
return {"prob": round(attr["prob"], 3), "svg": d.GetDrawingText(),
|
| 171 |
+
"top_atoms": [{"idx": int(i), "symbol": mol.GetAtomWithIdx(int(i)).GetSymbol(),
|
| 172 |
+
"importance": round(float(imp[i]), 2)}
|
| 173 |
+
for i in np.argsort(-imp)[:5]]}
|
| 174 |
+
|
| 175 |
+
# ---------------------------------------------------------------- severity
|
| 176 |
+
def sev_xr(sim): return "high" if sim>=0.85 else "mod" if sim>=0.70 else "none"
|
| 177 |
+
def sev_se(coh): return "high" if coh>=0.80 else "mod" if coh>=BASELINE+0.05 else "none"
|
| 178 |
+
def sev_allergy(rx,sim):
|
| 179 |
+
if any(w in rx.lower() for w in ["anaphyl","angioedema","severe"]): return "crit"
|
| 180 |
+
return "high" if sim>=0.78 else "mod"
|
| 181 |
+
def sev_ddi(p): return "high" if p>=0.70 else "mod" if p>=0.50 else "none"
|
| 182 |
+
RANK={"none":0,"mod":1,"high":2,"crit":3}
|
| 183 |
+
SEVN={"none":"Clear","mod":"Monitor","high":"Warning","crit":"Contraindication"}
|
| 184 |
+
|
| 185 |
+
def verdict_from(maxr):
|
| 186 |
+
if maxr>=3: return "HOLD","block_pending_review","Contraindication-level signal — route for manual review before advancing."
|
| 187 |
+
if maxr==2: return "FLAG","proceed_with_warning","Warning-level signal — proceed only with mitigation noted."
|
| 188 |
+
if maxr==1: return "FLAG","monitor","Monitor-level signal — advance with monitoring."
|
| 189 |
+
return "PASS","advance","No adverse signal above threshold in the evidence base."
|
| 190 |
+
|
| 191 |
+
def cat(key,name,sub,api,items): return {"key":key,"name":name,"sub":sub,"api":api,"items":items}
|
| 192 |
+
def catsev(items): return max([0]+[RANK[i["sev"]] for i in items])
|
| 193 |
+
|
| 194 |
+
# ---------------------------------------------------------------- assemble
|
| 195 |
+
def known_drug(name):
|
| 196 |
+
n = name.lower().strip()
|
| 197 |
+
# cross-reactivity (observed)
|
| 198 |
+
xr=[]
|
| 199 |
+
seen=set()
|
| 200 |
+
for r in sorted(XR_BY_DRUG.get(n,[]), key=lambda x:-x["sim"]):
|
| 201 |
+
if r["to"] in seen: continue
|
| 202 |
+
seen.add(r["to"])
|
| 203 |
+
s=sev_xr(r["sim"])
|
| 204 |
+
if s=="none": continue
|
| 205 |
+
xr.append({"find":"Structural cross-reactivity","to":r["to"],
|
| 206 |
+
"note":"Shares reaction ("+", ".join(r["reactions"][:2])+") with a structurally similar drug.",
|
| 207 |
+
"ev":"observed","pt":ALLERGEN_COUNT.get(r["to"],ALLERGEN_COUNT.get(n,0)),
|
| 208 |
+
"conf":round(r["sim"],2),"src":"MoLFormer + EHR","sev":s})
|
| 209 |
+
# side effects (observed)
|
| 210 |
+
se=[]
|
| 211 |
+
for r in sorted(SE_BY_DRUG.get(n,[]), key=lambda x:-x["cohesion"])[:5]:
|
| 212 |
+
s=sev_se(r["cohesion"])
|
| 213 |
+
if s=="none": continue
|
| 214 |
+
se.append({"find":r["reaction"].capitalize(),"to":None,
|
| 215 |
+
"note":f"Structurally cohesive class effect (cohesion {r['cohesion']:.2f} vs {BASELINE:.2f} baseline, n={r['n']}).",
|
| 216 |
+
"ev":"observed","pt":r["n"],"conf":round(r["cohesion"],2),"src":"cohesion analysis","sev":s})
|
| 217 |
+
# allergy (observed, patient-anchored, immune)
|
| 218 |
+
al=[]; seen=set()
|
| 219 |
+
for r in sorted(ALL_BY_DRUG.get(n,[]), key=lambda x:-x["sim"]):
|
| 220 |
+
if r["to"] in seen: continue
|
| 221 |
+
seen.add(r["to"])
|
| 222 |
+
s=sev_allergy(r["reaction"],r["sim"])
|
| 223 |
+
al.append({"find":"Immune cross-reaction","to":r["to"],
|
| 224 |
+
"note":f"Patient allergic to one reacted to the other ({r['reaction']}).",
|
| 225 |
+
"ev":"observed","pt":ALLERGEN_COUNT.get(n,ALLERGEN_COUNT.get(r["to"],1)),
|
| 226 |
+
"conf":round(r["sim"],2),"src":"patient history + MoLFormer","sev":s})
|
| 227 |
+
cats=[cat("ddi","Drug–drug interactions","co-administration risk","drug_drug_interaction",[]),
|
| 228 |
+
cat("xreact","Cross-reactivity","structural / class","cross_reactivity",xr),
|
| 229 |
+
cat("side","Adverse effects","class & dose-driven","adverse_effect",se),
|
| 230 |
+
cat("allergy","Allergy cross-reaction","patient immune history","allergy_cross_reaction",al)]
|
| 231 |
+
meta = "in EHR evidence base"
|
| 232 |
+
return finalize({"name":name,"meta":meta,"pair":False}, cats, "known")
|
| 233 |
+
|
| 234 |
+
def pair(a,b):
|
| 235 |
+
A,B=a.lower().strip(),b.lower().strip()
|
| 236 |
+
ddi=[]
|
| 237 |
+
if A in SMILES and B in SMILES:
|
| 238 |
+
p=ddi_smiles(SMILES[A],SMILES[B])
|
| 239 |
+
if p is not None:
|
| 240 |
+
s=sev_ddi(p)
|
| 241 |
+
if s!="none":
|
| 242 |
+
ddi.append({"find":"Predicted interaction","to":B,
|
| 243 |
+
"note":"SSI-DDI substructure-interaction model score.",
|
| 244 |
+
"ev":"predicted","pt":0,"conf":round(p,2),"src":"SSI-DDI (AUC~0.79)","sev":s})
|
| 245 |
+
# allergy / xreact between the specific pair (observed)
|
| 246 |
+
al=[]
|
| 247 |
+
for r in ALL_BY_DRUG.get(A,[]):
|
| 248 |
+
if r["to"]==B:
|
| 249 |
+
al.append({"find":"Immune cross-reaction","to":B,"note":f"Patient-anchored: {r['reaction']}.",
|
| 250 |
+
"ev":"observed","pt":ALLERGEN_COUNT.get(A,1),"conf":round(r["sim"],2),
|
| 251 |
+
"src":"patient history","sev":sev_allergy(r["reaction"],r["sim"])})
|
| 252 |
+
xr=[]
|
| 253 |
+
for r in XR_BY_DRUG.get(A,[]):
|
| 254 |
+
if r["to"]==B:
|
| 255 |
+
s=sev_xr(r["sim"])
|
| 256 |
+
if s!="none":
|
| 257 |
+
xr.append({"find":"Structural cross-reactivity","to":B,
|
| 258 |
+
"note":"Shares reaction ("+", ".join(r["reactions"][:2])+").",
|
| 259 |
+
"ev":"observed","pt":0,"conf":round(r["sim"],2),"src":"MoLFormer + EHR","sev":s})
|
| 260 |
+
cats=[cat("ddi","Drug–drug interactions","co-administration risk","drug_drug_interaction",ddi),
|
| 261 |
+
cat("xreact","Cross-reactivity","structural / class","cross_reactivity",xr),
|
| 262 |
+
cat("side","Adverse effects","class & dose-driven","adverse_effect",[]),
|
| 263 |
+
cat("allergy","Allergy cross-reaction","patient immune history","allergy_cross_reaction",al)]
|
| 264 |
+
return finalize({"name":f"{a} + {b}","meta":"co-administration","pair":True}, cats, "pair")
|
| 265 |
+
|
| 266 |
+
def novel(smiles, name=None):
|
| 267 |
+
vec = embed_smiles(smiles)
|
| 268 |
+
xr=[]; se=[]; analogs=[]
|
| 269 |
+
molformer_ok = vec is not None
|
| 270 |
+
if molformer_ok:
|
| 271 |
+
analogs = nearest_known(vec, k=6)
|
| 272 |
+
top = analogs[0]
|
| 273 |
+
for kn, sim in analogs:
|
| 274 |
+
if sim < 0.70: continue
|
| 275 |
+
# bridge to that analog's observed reactions
|
| 276 |
+
for r in SE_BY_DRUG.get(kn, [])[:2]:
|
| 277 |
+
se.append({"find":r["reaction"].capitalize(),"to":None,
|
| 278 |
+
"note":f"Resembles {kn} (sim {sim:.2f}), which shows this as a class effect.",
|
| 279 |
+
"ev":"predicted","pt":0,"conf":round(sim,2),"src":"MoLFormer analog bridge",
|
| 280 |
+
"sev":sev_se(r["cohesion"]) if sev_se(r["cohesion"])!="none" else "mod"})
|
| 281 |
+
for r in XR_BY_DRUG.get(kn, [])[:1]:
|
| 282 |
+
xr.append({"find":"Predicted cross-reactivity","to":f"{kn}-class",
|
| 283 |
+
"note":f"Structurally near {kn} (sim {sim:.2f}); inherits its cross-reactivity profile.",
|
| 284 |
+
"ev":"predicted","pt":0,"conf":round(sim,2),"src":"MoLFormer","sev":sev_xr(sim)})
|
| 285 |
+
break # top analog only for xreact headline
|
| 286 |
+
# DDI vs a few common known drugs (predicted)
|
| 287 |
+
ddi=[]
|
| 288 |
+
for partner in ["warfarin","aspirin","simvastatin","clopidogrel"]:
|
| 289 |
+
p=ddi_smiles(smiles, SMILES[partner])
|
| 290 |
+
if p is None: continue
|
| 291 |
+
s=sev_ddi(p)
|
| 292 |
+
if s=="none": continue
|
| 293 |
+
ddi.append({"find":"Predicted interaction","to":partner,
|
| 294 |
+
"note":"SSI-DDI score against a common co-medication.",
|
| 295 |
+
"ev":"predicted","pt":0,"conf":round(p,2),"src":"SSI-DDI (AUC~0.79)","sev":s})
|
| 296 |
+
ddi.sort(key=lambda x:-x["conf"]); ddi=ddi[:3]
|
| 297 |
+
# substructure attribution for the top predicted interaction
|
| 298 |
+
attribution=None
|
| 299 |
+
if ddi:
|
| 300 |
+
top_partner=ddi[0]["to"]
|
| 301 |
+
attribution=attribution_svg(smiles, SMILES[top_partner])
|
| 302 |
+
if attribution: attribution["partner"]=top_partner
|
| 303 |
+
# allergy unavailable for novel compounds
|
| 304 |
+
allergy_note=[{"find":"Requires patient history","to":None,
|
| 305 |
+
"note":"Allergy cross-reactivity is patient-anchored and unavailable for a compound not yet in the clinical record.",
|
| 306 |
+
"ev":"predicted","pt":0,"conf":0.0,"src":"—","sev":"none"}]
|
| 307 |
+
cats=[cat("ddi","Drug–drug interactions","predicted (SSI-DDI)","drug_drug_interaction",ddi),
|
| 308 |
+
cat("xreact","Cross-reactivity","structural analog","cross_reactivity",xr),
|
| 309 |
+
cat("side","Adverse effects","analog class effects","adverse_effect",se),
|
| 310 |
+
cat("allergy","Allergy cross-reaction","patient immune history","allergy_cross_reaction",
|
| 311 |
+
[] if molformer_ok else [])]
|
| 312 |
+
label = name or "Novel compound"
|
| 313 |
+
meta = (f"nearest known: {analogs[0][0]} ({analogs[0][1]:.2f})" if analogs else "structural screen")
|
| 314 |
+
res = finalize({"name":label,"meta":meta,"pair":False}, cats, "novel")
|
| 315 |
+
res["molformer_available"]=molformer_ok
|
| 316 |
+
res["allergy_status"]="unavailable_novel_compound"
|
| 317 |
+
res["attribution"]=attribution
|
| 318 |
+
return res
|
| 319 |
+
|
| 320 |
+
def finalize(subject, cats, mode):
|
| 321 |
+
maxr=max([0]+[catsev(c["items"]) for c in cats])
|
| 322 |
+
v,action,reason=verdict_from(maxr)
|
| 323 |
+
# flat signal list for API
|
| 324 |
+
signals=[]
|
| 325 |
+
for c in cats:
|
| 326 |
+
for it in c["items"]:
|
| 327 |
+
if it["sev"]=="none": continue
|
| 328 |
+
signals.append({"category":c["api"],"severity":it["sev"],
|
| 329 |
+
"finding":it["find"]+(" → "+it["to"] if it["to"] else ""),
|
| 330 |
+
"evidence":it["ev"],"patient_support":it["pt"] if it["ev"]=="observed" else 0,
|
| 331 |
+
"confidence":it["conf"]})
|
| 332 |
+
return {"query":subject["name"],"mode":mode,"subject":subject,
|
| 333 |
+
"verdict":v,"gate_action":action,"max_severity":["none","mod","high","crit"][maxr],
|
| 334 |
+
"reason":reason,"categories":cats,"signals":signals,
|
| 335 |
+
"provenance":"patient-level RWE · MIMIC clinical notes","molformer_available":True,
|
| 336 |
+
"allergy_available":PATIENT_DATA}
|
| 337 |
+
|
| 338 |
+
# ---------------------------------------------------------------- API
|
| 339 |
+
app = FastAPI(title="ClinSift")
|
| 340 |
+
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_methods=["*"], allow_headers=["*"])
|
| 341 |
+
|
| 342 |
+
class ScreenReq(BaseModel):
|
| 343 |
+
drug: str | None = None
|
| 344 |
+
drug_a: str | None = None
|
| 345 |
+
drug_b: str | None = None
|
| 346 |
+
class SmilesReq(BaseModel):
|
| 347 |
+
smiles: str
|
| 348 |
+
name: str | None = None
|
| 349 |
+
|
| 350 |
+
@app.get("/health")
|
| 351 |
+
def health(): return {"ok":True,"drugs":len(EMB_KEYS),"molformer":MOLFORMER not in (None,"unavailable"),
|
| 352 |
+
"patient_data":PATIENT_DATA}
|
| 353 |
+
|
| 354 |
+
@app.post("/screen")
|
| 355 |
+
def screen(r: ScreenReq):
|
| 356 |
+
if r.drug_a and r.drug_b: return pair(r.drug_a, r.drug_b)
|
| 357 |
+
if r.drug: return known_drug(r.drug)
|
| 358 |
+
return {"error":"provide drug or drug_a+drug_b"}
|
| 359 |
+
|
| 360 |
+
@app.post("/screen_smiles")
|
| 361 |
+
def screen_smiles(r: SmilesReq):
|
| 362 |
+
if smiles_to_graph(r.smiles) is None:
|
| 363 |
+
return {"error":f"invalid SMILES: {r.smiles}"}
|
| 364 |
+
return novel(r.smiles, r.name)
|
| 365 |
+
|
| 366 |
+
# serve the UI at "/" (same-origin: the page talks to this same backend)
|
| 367 |
+
from fastapi.responses import FileResponse, HTMLResponse
|
| 368 |
+
@app.get("/", response_class=HTMLResponse)
|
| 369 |
+
def home():
|
| 370 |
+
p = os.path.join(os.path.dirname(__file__), "ui.html")
|
| 371 |
+
return FileResponse(p) if os.path.exists(p) else HTMLResponse("<h1>ClinSift API</h1>")
|
data/crossreactivity_similarity.json
ADDED
|
@@ -0,0 +1,749 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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| 15 |
+
"transaminitis"
|
| 16 |
+
]
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"drug_a": "atenolol",
|
| 20 |
+
"drug_b": "metoprolol",
|
| 21 |
+
"similarity": 0.964,
|
| 22 |
+
"shared_reactions": [
|
| 23 |
+
"bradycardia"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"drug_a": "atenolol",
|
| 28 |
+
"drug_b": "labetalol",
|
| 29 |
+
"similarity": 0.925,
|
| 30 |
+
"shared_reactions": [
|
| 31 |
+
"bradycardia"
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"drug_a": "labetalol",
|
| 36 |
+
"drug_b": "metoprolol",
|
| 37 |
+
"similarity": 0.905,
|
| 38 |
+
"shared_reactions": [
|
| 39 |
+
"bradycardia"
|
| 40 |
+
]
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"drug_a": "atorvastatin",
|
| 44 |
+
"drug_b": "lipitor",
|
| 45 |
+
"similarity": 0.904,
|
| 46 |
+
"shared_reactions": [
|
| 47 |
+
"transaminitis"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
{
|
| 51 |
+
"drug_a": "losartan",
|
| 52 |
+
"drug_b": "metolazone",
|
| 53 |
+
"similarity": 0.899,
|
| 54 |
+
"shared_reactions": [
|
| 55 |
+
"worsening renal function"
|
| 56 |
+
]
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"drug_a": "metoprolol",
|
| 60 |
+
"drug_b": "metoprolol succinate",
|
| 61 |
+
"similarity": 0.889,
|
| 62 |
+
"shared_reactions": [
|
| 63 |
+
"bradycardia"
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"drug_a": "keflex",
|
| 68 |
+
"drug_b": "penicillins",
|
| 69 |
+
"similarity": 0.882,
|
| 70 |
+
"shared_reactions": [
|
| 71 |
+
"hives"
|
| 72 |
+
]
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"drug_a": "keflex",
|
| 76 |
+
"drug_b": "penicillin",
|
| 77 |
+
"similarity": 0.882,
|
| 78 |
+
"shared_reactions": [
|
| 79 |
+
"hives"
|
| 80 |
+
]
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"drug_a": "atenolol",
|
| 84 |
+
"drug_b": "metoprolol succinate",
|
| 85 |
+
"similarity": 0.871,
|
| 86 |
+
"shared_reactions": [
|
| 87 |
+
"bradycardia"
|
| 88 |
+
]
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"drug_a": "carvedilol",
|
| 92 |
+
"drug_b": "labetalol",
|
| 93 |
+
"similarity": 0.841,
|
| 94 |
+
"shared_reactions": [
|
| 95 |
+
"bradycardia"
|
| 96 |
+
]
|
| 97 |
+
},
|
| 98 |
+
{
|
| 99 |
+
"drug_a": "atorvastatin",
|
| 100 |
+
"drug_b": "methotrexate",
|
| 101 |
+
"similarity": 0.837,
|
| 102 |
+
"shared_reactions": [
|
| 103 |
+
"rising transaminitis",
|
| 104 |
+
"transaminitis"
|
| 105 |
+
]
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"drug_a": "methotrexate",
|
| 109 |
+
"drug_b": "voriconazole",
|
| 110 |
+
"similarity": 0.829,
|
| 111 |
+
"shared_reactions": [
|
| 112 |
+
"transaminitis"
|
| 113 |
+
]
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"drug_a": "labetalol",
|
| 117 |
+
"drug_b": "metoprolol succinate",
|
| 118 |
+
"similarity": 0.829,
|
| 119 |
+
"shared_reactions": [
|
| 120 |
+
"bradycardia"
|
| 121 |
+
]
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"drug_a": "atorvastatin",
|
| 125 |
+
"drug_b": "seroquel",
|
| 126 |
+
"similarity": 0.827,
|
| 127 |
+
"shared_reactions": [
|
| 128 |
+
"transaminitis"
|
| 129 |
+
]
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"drug_a": "amiodarone",
|
| 133 |
+
"drug_b": "carvedilol",
|
| 134 |
+
"similarity": 0.821,
|
| 135 |
+
"shared_reactions": [
|
| 136 |
+
"bradycardia"
|
| 137 |
+
]
|
| 138 |
+
},
|
| 139 |
+
{
|
| 140 |
+
"drug_a": "carvedilol",
|
| 141 |
+
"drug_b": "metoprolol",
|
| 142 |
+
"similarity": 0.81,
|
| 143 |
+
"shared_reactions": [
|
| 144 |
+
"bradycardia"
|
| 145 |
+
]
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"drug_a": "atorvastatin",
|
| 149 |
+
"drug_b": "voriconazole",
|
| 150 |
+
"similarity": 0.806,
|
| 151 |
+
"shared_reactions": [
|
| 152 |
+
"transaminitis"
|
| 153 |
+
]
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"drug_a": "amiodarone",
|
| 157 |
+
"drug_b": "labetalol",
|
| 158 |
+
"similarity": 0.804,
|
| 159 |
+
"shared_reactions": [
|
| 160 |
+
"bradycardia"
|
| 161 |
+
]
|
| 162 |
+
},
|
| 163 |
+
{
|
| 164 |
+
"drug_a": "atenolol",
|
| 165 |
+
"drug_b": "carvedilol",
|
| 166 |
+
"similarity": 0.8,
|
| 167 |
+
"shared_reactions": [
|
| 168 |
+
"bradycardia"
|
| 169 |
+
]
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"drug_a": "penicillins",
|
| 173 |
+
"drug_b": "sulfasalazine",
|
| 174 |
+
"similarity": 0.795,
|
| 175 |
+
"shared_reactions": [
|
| 176 |
+
"hives"
|
| 177 |
+
]
|
| 178 |
+
},
|
| 179 |
+
{
|
| 180 |
+
"drug_a": "penicillin",
|
| 181 |
+
"drug_b": "sulfasalazine",
|
| 182 |
+
"similarity": 0.795,
|
| 183 |
+
"shared_reactions": [
|
| 184 |
+
"hives"
|
| 185 |
+
]
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"drug_a": "metformin",
|
| 189 |
+
"drug_b": "methotrexate",
|
| 190 |
+
"similarity": 0.79,
|
| 191 |
+
"shared_reactions": [
|
| 192 |
+
"transaminitis"
|
| 193 |
+
]
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"drug_a": "methotrexate",
|
| 197 |
+
"drug_b": "penicillin",
|
| 198 |
+
"similarity": 0.79,
|
| 199 |
+
"shared_reactions": [
|
| 200 |
+
"hypersensitivity reaction"
|
| 201 |
+
]
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"drug_a": "cephalosporins",
|
| 205 |
+
"drug_b": "methotrexate",
|
| 206 |
+
"similarity": 0.786,
|
| 207 |
+
"shared_reactions": [
|
| 208 |
+
"transaminitis"
|
| 209 |
+
]
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
"drug_a": "amiodarone",
|
| 213 |
+
"drug_b": "metoprolol",
|
| 214 |
+
"similarity": 0.784,
|
| 215 |
+
"shared_reactions": [
|
| 216 |
+
"bradycardia"
|
| 217 |
+
]
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"drug_a": "carvedilol",
|
| 221 |
+
"drug_b": "metoprolol succinate",
|
| 222 |
+
"similarity": 0.78,
|
| 223 |
+
"shared_reactions": [
|
| 224 |
+
"bradycardia"
|
| 225 |
+
]
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"drug_a": "levaquin",
|
| 229 |
+
"drug_b": "sertraline",
|
| 230 |
+
"similarity": 0.779,
|
| 231 |
+
"shared_reactions": [
|
| 232 |
+
"qt prolongation"
|
| 233 |
+
]
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"drug_a": "lipitor",
|
| 237 |
+
"drug_b": "methotrexate",
|
| 238 |
+
"similarity": 0.773,
|
| 239 |
+
"shared_reactions": [
|
| 240 |
+
"transaminitis"
|
| 241 |
+
]
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"drug_a": "amiodarone",
|
| 245 |
+
"drug_b": "atenolol",
|
| 246 |
+
"similarity": 0.771,
|
| 247 |
+
"shared_reactions": [
|
| 248 |
+
"bradycardia"
|
| 249 |
+
]
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"drug_a": "augmentin",
|
| 253 |
+
"drug_b": "lipitor",
|
| 254 |
+
"similarity": 0.771,
|
| 255 |
+
"shared_reactions": [
|
| 256 |
+
"transaminitis"
|
| 257 |
+
]
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"drug_a": "augmentin",
|
| 261 |
+
"drug_b": "methotrexate",
|
| 262 |
+
"similarity": 0.77,
|
| 263 |
+
"shared_reactions": [
|
| 264 |
+
"transaminitis"
|
| 265 |
+
]
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"drug_a": "seroquel",
|
| 269 |
+
"drug_b": "voriconazole",
|
| 270 |
+
"similarity": 0.767,
|
| 271 |
+
"shared_reactions": [
|
| 272 |
+
"transaminitis"
|
| 273 |
+
]
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"drug_a": "compazine",
|
| 277 |
+
"drug_b": "reglan",
|
| 278 |
+
"similarity": 0.767,
|
| 279 |
+
"shared_reactions": [
|
| 280 |
+
"dystonic reaction",
|
| 281 |
+
"concern for dystonic reaction"
|
| 282 |
+
]
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
"drug_a": "ibuprofen",
|
| 286 |
+
"drug_b": "lisinopril",
|
| 287 |
+
"similarity": 0.764,
|
| 288 |
+
"shared_reactions": [
|
| 289 |
+
"acute renal failure"
|
| 290 |
+
]
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"drug_a": "keflex",
|
| 294 |
+
"drug_b": "levofloxacin",
|
| 295 |
+
"similarity": 0.762,
|
| 296 |
+
"shared_reactions": [
|
| 297 |
+
"hives"
|
| 298 |
+
]
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"drug_a": "methotrexate",
|
| 302 |
+
"drug_b": "seroquel",
|
| 303 |
+
"similarity": 0.761,
|
| 304 |
+
"shared_reactions": [
|
| 305 |
+
"transaminitis"
|
| 306 |
+
]
|
| 307 |
+
},
|
| 308 |
+
{
|
| 309 |
+
"drug_a": "atorvastatin",
|
| 310 |
+
"drug_b": "augmentin",
|
| 311 |
+
"similarity": 0.759,
|
| 312 |
+
"shared_reactions": [
|
| 313 |
+
"transaminitis"
|
| 314 |
+
]
|
| 315 |
+
},
|
| 316 |
+
{
|
| 317 |
+
"drug_a": "lisinopril",
|
| 318 |
+
"drug_b": "toradol",
|
| 319 |
+
"similarity": 0.756,
|
| 320 |
+
"shared_reactions": [
|
| 321 |
+
"elevated creatinine"
|
| 322 |
+
]
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
"drug_a": "allopurinol",
|
| 326 |
+
"drug_b": "ibuprofen",
|
| 327 |
+
"similarity": 0.756,
|
| 328 |
+
"shared_reactions": [
|
| 329 |
+
"acute renal failure"
|
| 330 |
+
]
|
| 331 |
+
},
|
| 332 |
+
{
|
| 333 |
+
"drug_a": "keflex",
|
| 334 |
+
"drug_b": "sulfasalazine",
|
| 335 |
+
"similarity": 0.747,
|
| 336 |
+
"shared_reactions": [
|
| 337 |
+
"hives"
|
| 338 |
+
]
|
| 339 |
+
},
|
| 340 |
+
{
|
| 341 |
+
"drug_a": "allopurinol",
|
| 342 |
+
"drug_b": "chlorthalidone",
|
| 343 |
+
"similarity": 0.747,
|
| 344 |
+
"shared_reactions": [
|
| 345 |
+
"acute renal failure"
|
| 346 |
+
]
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"drug_a": "allopurinol",
|
| 350 |
+
"drug_b": "metformin",
|
| 351 |
+
"similarity": 0.745,
|
| 352 |
+
"shared_reactions": [
|
| 353 |
+
"acute renal failure"
|
| 354 |
+
]
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"drug_a": "augmentin",
|
| 358 |
+
"drug_b": "cephalosporins",
|
| 359 |
+
"similarity": 0.745,
|
| 360 |
+
"shared_reactions": [
|
| 361 |
+
"transaminitis"
|
| 362 |
+
]
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
"drug_a": "levofloxacin",
|
| 366 |
+
"drug_b": "penicillins",
|
| 367 |
+
"similarity": 0.744,
|
| 368 |
+
"shared_reactions": [
|
| 369 |
+
"hives"
|
| 370 |
+
]
|
| 371 |
+
},
|
| 372 |
+
{
|
| 373 |
+
"drug_a": "levofloxacin",
|
| 374 |
+
"drug_b": "penicillin",
|
| 375 |
+
"similarity": 0.744,
|
| 376 |
+
"shared_reactions": [
|
| 377 |
+
"hives"
|
| 378 |
+
]
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"drug_a": "lipitor",
|
| 382 |
+
"drug_b": "seroquel",
|
| 383 |
+
"similarity": 0.743,
|
| 384 |
+
"shared_reactions": [
|
| 385 |
+
"transaminitis"
|
| 386 |
+
]
|
| 387 |
+
},
|
| 388 |
+
{
|
| 389 |
+
"drug_a": "lipitor",
|
| 390 |
+
"drug_b": "voriconazole",
|
| 391 |
+
"similarity": 0.741,
|
| 392 |
+
"shared_reactions": [
|
| 393 |
+
"transaminitis"
|
| 394 |
+
]
|
| 395 |
+
},
|
| 396 |
+
{
|
| 397 |
+
"drug_a": "chlorthalidone",
|
| 398 |
+
"drug_b": "ibuprofen",
|
| 399 |
+
"similarity": 0.735,
|
| 400 |
+
"shared_reactions": [
|
| 401 |
+
"acute renal failure"
|
| 402 |
+
]
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
"drug_a": "augmentin",
|
| 406 |
+
"drug_b": "voriconazole",
|
| 407 |
+
"similarity": 0.733,
|
| 408 |
+
"shared_reactions": [
|
| 409 |
+
"transaminitis"
|
| 410 |
+
]
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"drug_a": "metformin",
|
| 414 |
+
"drug_b": "voriconazole",
|
| 415 |
+
"similarity": 0.728,
|
| 416 |
+
"shared_reactions": [
|
| 417 |
+
"transaminitis"
|
| 418 |
+
]
|
| 419 |
+
},
|
| 420 |
+
{
|
| 421 |
+
"drug_a": "amiodarone",
|
| 422 |
+
"drug_b": "metoprolol succinate",
|
| 423 |
+
"similarity": 0.725,
|
| 424 |
+
"shared_reactions": [
|
| 425 |
+
"bradycardia"
|
| 426 |
+
]
|
| 427 |
+
},
|
| 428 |
+
{
|
| 429 |
+
"drug_a": "augmentin",
|
| 430 |
+
"drug_b": "statin",
|
| 431 |
+
"similarity": 0.724,
|
| 432 |
+
"shared_reactions": [
|
| 433 |
+
"transaminitis"
|
| 434 |
+
]
|
| 435 |
+
},
|
| 436 |
+
{
|
| 437 |
+
"drug_a": "augmentin",
|
| 438 |
+
"drug_b": "simvastatin",
|
| 439 |
+
"similarity": 0.724,
|
| 440 |
+
"shared_reactions": [
|
| 441 |
+
"transaminitis"
|
| 442 |
+
]
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
"drug_a": "cephalosporins",
|
| 446 |
+
"drug_b": "metformin",
|
| 447 |
+
"similarity": 0.723,
|
| 448 |
+
"shared_reactions": [
|
| 449 |
+
"transaminitis"
|
| 450 |
+
]
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"drug_a": "quetiapine",
|
| 454 |
+
"drug_b": "venlafaxine",
|
| 455 |
+
"similarity": 0.721,
|
| 456 |
+
"shared_reactions": [
|
| 457 |
+
"prolonged qtc"
|
| 458 |
+
]
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"drug_a": "oxycodone",
|
| 462 |
+
"drug_b": "quetiapine",
|
| 463 |
+
"similarity": 0.719,
|
| 464 |
+
"shared_reactions": [
|
| 465 |
+
"prolonged qtc"
|
| 466 |
+
]
|
| 467 |
+
},
|
| 468 |
+
{
|
| 469 |
+
"drug_a": "allopurinol",
|
| 470 |
+
"drug_b": "lisinopril",
|
| 471 |
+
"similarity": 0.706,
|
| 472 |
+
"shared_reactions": [
|
| 473 |
+
"acute renal failure"
|
| 474 |
+
]
|
| 475 |
+
},
|
| 476 |
+
{
|
| 477 |
+
"drug_a": "augmentin",
|
| 478 |
+
"drug_b": "seroquel",
|
| 479 |
+
"similarity": 0.706,
|
| 480 |
+
"shared_reactions": [
|
| 481 |
+
"transaminitis"
|
| 482 |
+
]
|
| 483 |
+
},
|
| 484 |
+
{
|
| 485 |
+
"drug_a": "oxycodone",
|
| 486 |
+
"drug_b": "venlafaxine",
|
| 487 |
+
"similarity": 0.702,
|
| 488 |
+
"shared_reactions": [
|
| 489 |
+
"prolonged qtc"
|
| 490 |
+
]
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"drug_a": "atorvastatin",
|
| 494 |
+
"drug_b": "statin",
|
| 495 |
+
"similarity": 0.7,
|
| 496 |
+
"shared_reactions": [
|
| 497 |
+
"transaminitis"
|
| 498 |
+
]
|
| 499 |
+
},
|
| 500 |
+
{
|
| 501 |
+
"drug_a": "atorvastatin",
|
| 502 |
+
"drug_b": "simvastatin",
|
| 503 |
+
"similarity": 0.7,
|
| 504 |
+
"shared_reactions": [
|
| 505 |
+
"transaminitis"
|
| 506 |
+
]
|
| 507 |
+
},
|
| 508 |
+
{
|
| 509 |
+
"drug_a": "lisinopril",
|
| 510 |
+
"drug_b": "metformin",
|
| 511 |
+
"similarity": 0.697,
|
| 512 |
+
"shared_reactions": [
|
| 513 |
+
"acute renal failure"
|
| 514 |
+
]
|
| 515 |
+
},
|
| 516 |
+
{
|
| 517 |
+
"drug_a": "cephalosporins",
|
| 518 |
+
"drug_b": "voriconazole",
|
| 519 |
+
"similarity": 0.695,
|
| 520 |
+
"shared_reactions": [
|
| 521 |
+
"transaminitis"
|
| 522 |
+
]
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"drug_a": "chlorthalidone",
|
| 526 |
+
"drug_b": "lisinopril",
|
| 527 |
+
"similarity": 0.689,
|
| 528 |
+
"shared_reactions": [
|
| 529 |
+
"acute renal failure"
|
| 530 |
+
]
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"drug_a": "levofloxacin",
|
| 534 |
+
"drug_b": "sulfasalazine",
|
| 535 |
+
"similarity": 0.686,
|
| 536 |
+
"shared_reactions": [
|
| 537 |
+
"hives"
|
| 538 |
+
]
|
| 539 |
+
},
|
| 540 |
+
{
|
| 541 |
+
"drug_a": "atorvastatin",
|
| 542 |
+
"drug_b": "cephalosporins",
|
| 543 |
+
"similarity": 0.68,
|
| 544 |
+
"shared_reactions": [
|
| 545 |
+
"transaminitis"
|
| 546 |
+
]
|
| 547 |
+
},
|
| 548 |
+
{
|
| 549 |
+
"drug_a": "ibuprofen",
|
| 550 |
+
"drug_b": "metformin",
|
| 551 |
+
"similarity": 0.676,
|
| 552 |
+
"shared_reactions": [
|
| 553 |
+
"acute renal failure"
|
| 554 |
+
]
|
| 555 |
+
},
|
| 556 |
+
{
|
| 557 |
+
"drug_a": "cephalosporins",
|
| 558 |
+
"drug_b": "statin",
|
| 559 |
+
"similarity": 0.676,
|
| 560 |
+
"shared_reactions": [
|
| 561 |
+
"transaminitis"
|
| 562 |
+
]
|
| 563 |
+
},
|
| 564 |
+
{
|
| 565 |
+
"drug_a": "cephalosporins",
|
| 566 |
+
"drug_b": "simvastatin",
|
| 567 |
+
"similarity": 0.676,
|
| 568 |
+
"shared_reactions": [
|
| 569 |
+
"transaminitis"
|
| 570 |
+
]
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"drug_a": "lipitor",
|
| 574 |
+
"drug_b": "statin",
|
| 575 |
+
"similarity": 0.673,
|
| 576 |
+
"shared_reactions": [
|
| 577 |
+
"transaminitis"
|
| 578 |
+
]
|
| 579 |
+
},
|
| 580 |
+
{
|
| 581 |
+
"drug_a": "lipitor",
|
| 582 |
+
"drug_b": "simvastatin",
|
| 583 |
+
"similarity": 0.673,
|
| 584 |
+
"shared_reactions": [
|
| 585 |
+
"transaminitis"
|
| 586 |
+
]
|
| 587 |
+
},
|
| 588 |
+
{
|
| 589 |
+
"drug_a": "chlorthalidone",
|
| 590 |
+
"drug_b": "metformin",
|
| 591 |
+
"similarity": 0.666,
|
| 592 |
+
"shared_reactions": [
|
| 593 |
+
"acute renal failure"
|
| 594 |
+
]
|
| 595 |
+
},
|
| 596 |
+
{
|
| 597 |
+
"drug_a": "chlorthalidone",
|
| 598 |
+
"drug_b": "cytoxan",
|
| 599 |
+
"similarity": 0.666,
|
| 600 |
+
"shared_reactions": [
|
| 601 |
+
"acute renal failure"
|
| 602 |
+
]
|
| 603 |
+
},
|
| 604 |
+
{
|
| 605 |
+
"drug_a": "cytoxan",
|
| 606 |
+
"drug_b": "lisinopril",
|
| 607 |
+
"similarity": 0.663,
|
| 608 |
+
"shared_reactions": [
|
| 609 |
+
"acute renal failure"
|
| 610 |
+
]
|
| 611 |
+
},
|
| 612 |
+
{
|
| 613 |
+
"drug_a": "methotrexate",
|
| 614 |
+
"drug_b": "statin",
|
| 615 |
+
"similarity": 0.659,
|
| 616 |
+
"shared_reactions": [
|
| 617 |
+
"transaminitis"
|
| 618 |
+
]
|
| 619 |
+
},
|
| 620 |
+
{
|
| 621 |
+
"drug_a": "methotrexate",
|
| 622 |
+
"drug_b": "simvastatin",
|
| 623 |
+
"similarity": 0.659,
|
| 624 |
+
"shared_reactions": [
|
| 625 |
+
"transaminitis"
|
| 626 |
+
]
|
| 627 |
+
},
|
| 628 |
+
{
|
| 629 |
+
"drug_a": "cytoxan",
|
| 630 |
+
"drug_b": "ibuprofen",
|
| 631 |
+
"similarity": 0.656,
|
| 632 |
+
"shared_reactions": [
|
| 633 |
+
"acute renal failure"
|
| 634 |
+
]
|
| 635 |
+
},
|
| 636 |
+
{
|
| 637 |
+
"drug_a": "cephalosporins",
|
| 638 |
+
"drug_b": "lipitor",
|
| 639 |
+
"similarity": 0.638,
|
| 640 |
+
"shared_reactions": [
|
| 641 |
+
"transaminitis"
|
| 642 |
+
]
|
| 643 |
+
},
|
| 644 |
+
{
|
| 645 |
+
"drug_a": "statin",
|
| 646 |
+
"drug_b": "voriconazole",
|
| 647 |
+
"similarity": 0.633,
|
| 648 |
+
"shared_reactions": [
|
| 649 |
+
"transaminitis"
|
| 650 |
+
]
|
| 651 |
+
},
|
| 652 |
+
{
|
| 653 |
+
"drug_a": "simvastatin",
|
| 654 |
+
"drug_b": "voriconazole",
|
| 655 |
+
"similarity": 0.633,
|
| 656 |
+
"shared_reactions": [
|
| 657 |
+
"transaminitis"
|
| 658 |
+
]
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
"drug_a": "atorvastatin",
|
| 662 |
+
"drug_b": "metformin",
|
| 663 |
+
"similarity": 0.63,
|
| 664 |
+
"shared_reactions": [
|
| 665 |
+
"transaminitis"
|
| 666 |
+
]
|
| 667 |
+
},
|
| 668 |
+
{
|
| 669 |
+
"drug_a": "augmentin",
|
| 670 |
+
"drug_b": "metformin",
|
| 671 |
+
"similarity": 0.626,
|
| 672 |
+
"shared_reactions": [
|
| 673 |
+
"transaminitis"
|
| 674 |
+
]
|
| 675 |
+
},
|
| 676 |
+
{
|
| 677 |
+
"drug_a": "metformin",
|
| 678 |
+
"drug_b": "seroquel",
|
| 679 |
+
"similarity": 0.626,
|
| 680 |
+
"shared_reactions": [
|
| 681 |
+
"transaminitis"
|
| 682 |
+
]
|
| 683 |
+
},
|
| 684 |
+
{
|
| 685 |
+
"drug_a": "cytoxan",
|
| 686 |
+
"drug_b": "metformin",
|
| 687 |
+
"similarity": 0.62,
|
| 688 |
+
"shared_reactions": [
|
| 689 |
+
"acute renal failure"
|
| 690 |
+
]
|
| 691 |
+
},
|
| 692 |
+
{
|
| 693 |
+
"drug_a": "allopurinol",
|
| 694 |
+
"drug_b": "cytoxan",
|
| 695 |
+
"similarity": 0.61,
|
| 696 |
+
"shared_reactions": [
|
| 697 |
+
"acute renal failure"
|
| 698 |
+
]
|
| 699 |
+
},
|
| 700 |
+
{
|
| 701 |
+
"drug_a": "cephalosporins",
|
| 702 |
+
"drug_b": "seroquel",
|
| 703 |
+
"similarity": 0.601,
|
| 704 |
+
"shared_reactions": [
|
| 705 |
+
"transaminitis"
|
| 706 |
+
]
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
"drug_a": "seroquel",
|
| 710 |
+
"drug_b": "statin",
|
| 711 |
+
"similarity": 0.599,
|
| 712 |
+
"shared_reactions": [
|
| 713 |
+
"transaminitis"
|
| 714 |
+
]
|
| 715 |
+
},
|
| 716 |
+
{
|
| 717 |
+
"drug_a": "seroquel",
|
| 718 |
+
"drug_b": "simvastatin",
|
| 719 |
+
"similarity": 0.599,
|
| 720 |
+
"shared_reactions": [
|
| 721 |
+
"transaminitis"
|
| 722 |
+
]
|
| 723 |
+
},
|
| 724 |
+
{
|
| 725 |
+
"drug_a": "lipitor",
|
| 726 |
+
"drug_b": "metformin",
|
| 727 |
+
"similarity": 0.548,
|
| 728 |
+
"shared_reactions": [
|
| 729 |
+
"transaminitis",
|
| 730 |
+
"drug-induced hepatitis"
|
| 731 |
+
]
|
| 732 |
+
},
|
| 733 |
+
{
|
| 734 |
+
"drug_a": "metformin",
|
| 735 |
+
"drug_b": "statin",
|
| 736 |
+
"similarity": 0.523,
|
| 737 |
+
"shared_reactions": [
|
| 738 |
+
"transaminitis"
|
| 739 |
+
]
|
| 740 |
+
},
|
| 741 |
+
{
|
| 742 |
+
"drug_a": "metformin",
|
| 743 |
+
"drug_b": "simvastatin",
|
| 744 |
+
"similarity": 0.523,
|
| 745 |
+
"shared_reactions": [
|
| 746 |
+
"transaminitis"
|
| 747 |
+
]
|
| 748 |
+
}
|
| 749 |
+
]
|
data/sideeffect_cohesion.json
ADDED
|
@@ -0,0 +1,936 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"cohesion": 0.921,
|
| 4 |
+
"reaction": "hematuria",
|
| 5 |
+
"n_drugs": 3,
|
| 6 |
+
"drugs": [
|
| 7 |
+
"asa",
|
| 8 |
+
"aspirin",
|
| 9 |
+
"warfarin"
|
| 10 |
+
]
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"cohesion": 0.92,
|
| 14 |
+
"reaction": "they have their own set of side effects",
|
| 15 |
+
"n_drugs": 5,
|
| 16 |
+
"drugs": [
|
| 17 |
+
"advil",
|
| 18 |
+
"aleve",
|
| 19 |
+
"ibuprofen",
|
| 20 |
+
"motrin",
|
| 21 |
+
"naprosyn"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cohesion": 0.92,
|
| 26 |
+
"reaction": "bleeding and ulcers in your digestive system",
|
| 27 |
+
"n_drugs": 5,
|
| 28 |
+
"drugs": [
|
| 29 |
+
"aleve",
|
| 30 |
+
"ibuprofen",
|
| 31 |
+
"motrin",
|
| 32 |
+
"naproxen",
|
| 33 |
+
"nuprin"
|
| 34 |
+
]
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
"cohesion": 0.849,
|
| 38 |
+
"reaction": "disrupted sleep",
|
| 39 |
+
"n_drugs": 3,
|
| 40 |
+
"drugs": [
|
| 41 |
+
"clonidine",
|
| 42 |
+
"seroquel",
|
| 43 |
+
"vistaril"
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"cohesion": 0.849,
|
| 48 |
+
"reaction": "rhabdomyolysis",
|
| 49 |
+
"n_drugs": 3,
|
| 50 |
+
"drugs": [
|
| 51 |
+
"oxycodone",
|
| 52 |
+
"simvastatin",
|
| 53 |
+
"statin"
|
| 54 |
+
]
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"cohesion": 0.843,
|
| 58 |
+
"reaction": "gi bleed",
|
| 59 |
+
"n_drugs": 4,
|
| 60 |
+
"drugs": [
|
| 61 |
+
"clopidogrel",
|
| 62 |
+
"ibrutinib",
|
| 63 |
+
"plavix",
|
| 64 |
+
"rivaroxaban"
|
| 65 |
+
]
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"cohesion": 0.839,
|
| 69 |
+
"reaction": "lightheaded",
|
| 70 |
+
"n_drugs": 3,
|
| 71 |
+
"drugs": [
|
| 72 |
+
"atenolol",
|
| 73 |
+
"labetalol",
|
| 74 |
+
"reglan"
|
| 75 |
+
]
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"cohesion": 0.834,
|
| 79 |
+
"reaction": "bradycardia",
|
| 80 |
+
"n_drugs": 6,
|
| 81 |
+
"drugs": [
|
| 82 |
+
"amiodarone",
|
| 83 |
+
"atenolol",
|
| 84 |
+
"carvedilol",
|
| 85 |
+
"labetalol",
|
| 86 |
+
"metoprolol",
|
| 87 |
+
"metoprolol succinate"
|
| 88 |
+
]
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"cohesion": 0.811,
|
| 92 |
+
"reaction": "bradycardic",
|
| 93 |
+
"n_drugs": 4,
|
| 94 |
+
"drugs": [
|
| 95 |
+
"atenolol",
|
| 96 |
+
"dilaudid",
|
| 97 |
+
"metoprolol",
|
| 98 |
+
"propanolol"
|
| 99 |
+
]
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"cohesion": 0.804,
|
| 103 |
+
"reaction": "morphine and oxycodone and ambien and ativan can cause sleepiness",
|
| 104 |
+
"n_drugs": 4,
|
| 105 |
+
"drugs": [
|
| 106 |
+
"ambien",
|
| 107 |
+
"ativan",
|
| 108 |
+
"morphine",
|
| 109 |
+
"oxycodone"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"cohesion": 0.804,
|
| 114 |
+
"reaction": "n/v",
|
| 115 |
+
"n_drugs": 4,
|
| 116 |
+
"drugs": [
|
| 117 |
+
"doxorubicin",
|
| 118 |
+
"levaquin",
|
| 119 |
+
"methotrexate",
|
| 120 |
+
"pazopanib"
|
| 121 |
+
]
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"cohesion": 0.803,
|
| 125 |
+
"reaction": "brbpr",
|
| 126 |
+
"n_drugs": 3,
|
| 127 |
+
"drugs": [
|
| 128 |
+
"apixaban",
|
| 129 |
+
"rivaroxaban",
|
| 130 |
+
"warfarin"
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"cohesion": 0.802,
|
| 135 |
+
"reaction": "lightheadedness",
|
| 136 |
+
"n_drugs": 6,
|
| 137 |
+
"drugs": [
|
| 138 |
+
"amlodipine",
|
| 139 |
+
"hydrochlorothiazide",
|
| 140 |
+
"labetalol",
|
| 141 |
+
"losartan",
|
| 142 |
+
"metoprolol",
|
| 143 |
+
"tramadol"
|
| 144 |
+
]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"cohesion": 0.796,
|
| 148 |
+
"reaction": "exacerbating falls",
|
| 149 |
+
"n_drugs": 3,
|
| 150 |
+
"drugs": [
|
| 151 |
+
"ativan",
|
| 152 |
+
"benadryl",
|
| 153 |
+
"tizanidine"
|
| 154 |
+
]
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"cohesion": 0.793,
|
| 158 |
+
"reaction": "mild nausea",
|
| 159 |
+
"n_drugs": 3,
|
| 160 |
+
"drugs": [
|
| 161 |
+
"dilaudid",
|
| 162 |
+
"methotrexate",
|
| 163 |
+
"oxycontin"
|
| 164 |
+
]
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"cohesion": 0.793,
|
| 168 |
+
"reaction": "abdominal pain",
|
| 169 |
+
"n_drugs": 3,
|
| 170 |
+
"drugs": [
|
| 171 |
+
"acetaminophen",
|
| 172 |
+
"asa",
|
| 173 |
+
"bactrim"
|
| 174 |
+
]
|
| 175 |
+
},
|
| 176 |
+
{
|
| 177 |
+
"cohesion": 0.779,
|
| 178 |
+
"reaction": "gi bleeding",
|
| 179 |
+
"n_drugs": 3,
|
| 180 |
+
"drugs": [
|
| 181 |
+
"aspirin",
|
| 182 |
+
"ibrutinib",
|
| 183 |
+
"warfarin"
|
| 184 |
+
]
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"cohesion": 0.777,
|
| 188 |
+
"reaction": "constipation",
|
| 189 |
+
"n_drugs": 13,
|
| 190 |
+
"drugs": [
|
| 191 |
+
"amlodipine",
|
| 192 |
+
"codeine",
|
| 193 |
+
"dilaudid",
|
| 194 |
+
"hydrocodone",
|
| 195 |
+
"hydromorphone",
|
| 196 |
+
"lactulose",
|
| 197 |
+
"morphine",
|
| 198 |
+
"opioid",
|
| 199 |
+
"oxycodone",
|
| 200 |
+
"percocet",
|
| 201 |
+
"tramadol",
|
| 202 |
+
"vicodin",
|
| 203 |
+
"zofran"
|
| 204 |
+
]
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"cohesion": 0.771,
|
| 208 |
+
"reaction": "hematemesis",
|
| 209 |
+
"n_drugs": 3,
|
| 210 |
+
"drugs": [
|
| 211 |
+
"apixaban",
|
| 212 |
+
"ibuprofen",
|
| 213 |
+
"rivaroxaban"
|
| 214 |
+
]
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"cohesion": 0.77,
|
| 218 |
+
"reaction": "acute kidney injury",
|
| 219 |
+
"n_drugs": 3,
|
| 220 |
+
"drugs": [
|
| 221 |
+
"chlorthalidone",
|
| 222 |
+
"lasix",
|
| 223 |
+
"lisinopril"
|
| 224 |
+
]
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
"cohesion": 0.764,
|
| 228 |
+
"reaction": "anemia",
|
| 229 |
+
"n_drugs": 7,
|
| 230 |
+
"drugs": [
|
| 231 |
+
"decitabine",
|
| 232 |
+
"doxorubicin",
|
| 233 |
+
"gemcitabine",
|
| 234 |
+
"imuran",
|
| 235 |
+
"methotrexate",
|
| 236 |
+
"rifaximin",
|
| 237 |
+
"xeloda"
|
| 238 |
+
]
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"cohesion": 0.762,
|
| 242 |
+
"reaction": "sedation",
|
| 243 |
+
"n_drugs": 7,
|
| 244 |
+
"drugs": [
|
| 245 |
+
"ativan",
|
| 246 |
+
"dilaudid",
|
| 247 |
+
"ketamine",
|
| 248 |
+
"methadone",
|
| 249 |
+
"olanzapine",
|
| 250 |
+
"seroquel",
|
| 251 |
+
"tramadol"
|
| 252 |
+
]
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"cohesion": 0.761,
|
| 256 |
+
"reaction": "drug reaction",
|
| 257 |
+
"n_drugs": 4,
|
| 258 |
+
"drugs": [
|
| 259 |
+
"amlodipine",
|
| 260 |
+
"furosemide",
|
| 261 |
+
"olmesartan",
|
| 262 |
+
"zosyn"
|
| 263 |
+
]
|
| 264 |
+
},
|
| 265 |
+
{
|
| 266 |
+
"cohesion": 0.758,
|
| 267 |
+
"reaction": "melena",
|
| 268 |
+
"n_drugs": 3,
|
| 269 |
+
"drugs": [
|
| 270 |
+
"ibuprofen",
|
| 271 |
+
"rivaroxaban",
|
| 272 |
+
"warfarin"
|
| 273 |
+
]
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"cohesion": 0.756,
|
| 277 |
+
"reaction": "fatigue",
|
| 278 |
+
"n_drugs": 5,
|
| 279 |
+
"drugs": [
|
| 280 |
+
"gemcitabine",
|
| 281 |
+
"imuran",
|
| 282 |
+
"jardiance",
|
| 283 |
+
"methotrexate",
|
| 284 |
+
"sorafenib"
|
| 285 |
+
]
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"cohesion": 0.754,
|
| 289 |
+
"reaction": "lethargic",
|
| 290 |
+
"n_drugs": 5,
|
| 291 |
+
"drugs": [
|
| 292 |
+
"ativan",
|
| 293 |
+
"benzatropine",
|
| 294 |
+
"dilaudid",
|
| 295 |
+
"reglan",
|
| 296 |
+
"roxicet"
|
| 297 |
+
]
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"cohesion": 0.751,
|
| 301 |
+
"reaction": "dizziness",
|
| 302 |
+
"n_drugs": 10,
|
| 303 |
+
"drugs": [
|
| 304 |
+
"lisinopril",
|
| 305 |
+
"losartan",
|
| 306 |
+
"metoprolol",
|
| 307 |
+
"mirapex",
|
| 308 |
+
"oxycodone",
|
| 309 |
+
"plavix",
|
| 310 |
+
"tramadol",
|
| 311 |
+
"velcade",
|
| 312 |
+
"voriconazole",
|
| 313 |
+
"zonegran"
|
| 314 |
+
]
|
| 315 |
+
},
|
| 316 |
+
{
|
| 317 |
+
"cohesion": 0.751,
|
| 318 |
+
"reaction": "ams",
|
| 319 |
+
"n_drugs": 3,
|
| 320 |
+
"drugs": [
|
| 321 |
+
"oxycodone",
|
| 322 |
+
"roxicet",
|
| 323 |
+
"tacrolimus"
|
| 324 |
+
]
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"cohesion": 0.744,
|
| 328 |
+
"reaction": "malaise",
|
| 329 |
+
"n_drugs": 3,
|
| 330 |
+
"drugs": [
|
| 331 |
+
"gemcitabine",
|
| 332 |
+
"macrobid",
|
| 333 |
+
"pemetrexed"
|
| 334 |
+
]
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"cohesion": 0.744,
|
| 338 |
+
"reaction": "neutropenia",
|
| 339 |
+
"n_drugs": 8,
|
| 340 |
+
"drugs": [
|
| 341 |
+
"5-fu",
|
| 342 |
+
"folfirinox",
|
| 343 |
+
"folfox",
|
| 344 |
+
"gemcitabine",
|
| 345 |
+
"idelalisib",
|
| 346 |
+
"methotrexate",
|
| 347 |
+
"pemetrexed",
|
| 348 |
+
"revlimid"
|
| 349 |
+
]
|
| 350 |
+
},
|
| 351 |
+
{
|
| 352 |
+
"cohesion": 0.741,
|
| 353 |
+
"reaction": "thrombocytopenia",
|
| 354 |
+
"n_drugs": 7,
|
| 355 |
+
"drugs": [
|
| 356 |
+
"ceftriaxone",
|
| 357 |
+
"decitabine",
|
| 358 |
+
"folfox",
|
| 359 |
+
"methotrexate",
|
| 360 |
+
"pradaxa",
|
| 361 |
+
"probenecid",
|
| 362 |
+
"sunitinib"
|
| 363 |
+
]
|
| 364 |
+
},
|
| 365 |
+
{
|
| 366 |
+
"cohesion": 0.741,
|
| 367 |
+
"reaction": "elevated lfts",
|
| 368 |
+
"n_drugs": 3,
|
| 369 |
+
"drugs": [
|
| 370 |
+
"augmentin",
|
| 371 |
+
"minocycline",
|
| 372 |
+
"posaconazole"
|
| 373 |
+
]
|
| 374 |
+
},
|
| 375 |
+
{
|
| 376 |
+
"cohesion": 0.732,
|
| 377 |
+
"reaction": "itching",
|
| 378 |
+
"n_drugs": 7,
|
| 379 |
+
"drugs": [
|
| 380 |
+
"cipro",
|
| 381 |
+
"codeine",
|
| 382 |
+
"cyclosporin",
|
| 383 |
+
"dilaudid",
|
| 384 |
+
"minocycline",
|
| 385 |
+
"morphine",
|
| 386 |
+
"percocet"
|
| 387 |
+
]
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"cohesion": 0.729,
|
| 391 |
+
"reaction": "altered mental status",
|
| 392 |
+
"n_drugs": 16,
|
| 393 |
+
"drugs": [
|
| 394 |
+
"citalopram",
|
| 395 |
+
"dacarbazine",
|
| 396 |
+
"gabapentin",
|
| 397 |
+
"librium",
|
| 398 |
+
"methadone",
|
| 399 |
+
"neurontin",
|
| 400 |
+
"oxycodone",
|
| 401 |
+
"oxycontin",
|
| 402 |
+
"percocet",
|
| 403 |
+
"quetiapine",
|
| 404 |
+
"roxicet",
|
| 405 |
+
"seroquel",
|
| 406 |
+
"sertraline",
|
| 407 |
+
"tizanidine",
|
| 408 |
+
"vicodin",
|
| 409 |
+
"zosyn"
|
| 410 |
+
]
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"cohesion": 0.725,
|
| 414 |
+
"reaction": "chills",
|
| 415 |
+
"n_drugs": 3,
|
| 416 |
+
"drugs": [
|
| 417 |
+
"gemcitabine",
|
| 418 |
+
"macrobid",
|
| 419 |
+
"zosyn"
|
| 420 |
+
]
|
| 421 |
+
},
|
| 422 |
+
{
|
| 423 |
+
"cohesion": 0.723,
|
| 424 |
+
"reaction": "orthostatic hypotension",
|
| 425 |
+
"n_drugs": 4,
|
| 426 |
+
"drugs": [
|
| 427 |
+
"chlorthalidone",
|
| 428 |
+
"lisinopril",
|
| 429 |
+
"metoprolol",
|
| 430 |
+
"seroquel"
|
| 431 |
+
]
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"cohesion": 0.723,
|
| 435 |
+
"reaction": "vomiting",
|
| 436 |
+
"n_drugs": 5,
|
| 437 |
+
"drugs": [
|
| 438 |
+
"codeine",
|
| 439 |
+
"dilaudid",
|
| 440 |
+
"gemcitabine",
|
| 441 |
+
"morphine",
|
| 442 |
+
"sln"
|
| 443 |
+
]
|
| 444 |
+
},
|
| 445 |
+
{
|
| 446 |
+
"cohesion": 0.717,
|
| 447 |
+
"reaction": "confusion",
|
| 448 |
+
"n_drugs": 9,
|
| 449 |
+
"drugs": [
|
| 450 |
+
"clonazepam",
|
| 451 |
+
"dilaudid",
|
| 452 |
+
"isosorbide dinitrate",
|
| 453 |
+
"mirapex",
|
| 454 |
+
"oxycodone",
|
| 455 |
+
"oxycontin",
|
| 456 |
+
"prednisone",
|
| 457 |
+
"roxicet",
|
| 458 |
+
"steroids"
|
| 459 |
+
]
|
| 460 |
+
},
|
| 461 |
+
{
|
| 462 |
+
"cohesion": 0.717,
|
| 463 |
+
"reaction": "visual hallucinations",
|
| 464 |
+
"n_drugs": 3,
|
| 465 |
+
"drugs": [
|
| 466 |
+
"mirapex",
|
| 467 |
+
"oxycodone",
|
| 468 |
+
"sertraline"
|
| 469 |
+
]
|
| 470 |
+
},
|
| 471 |
+
{
|
| 472 |
+
"cohesion": 0.714,
|
| 473 |
+
"reaction": "prolonged qtc",
|
| 474 |
+
"n_drugs": 3,
|
| 475 |
+
"drugs": [
|
| 476 |
+
"oxycodone",
|
| 477 |
+
"quetiapine",
|
| 478 |
+
"venlafaxine"
|
| 479 |
+
]
|
| 480 |
+
},
|
| 481 |
+
{
|
| 482 |
+
"cohesion": 0.714,
|
| 483 |
+
"reaction": "fever",
|
| 484 |
+
"n_drugs": 4,
|
| 485 |
+
"drugs": [
|
| 486 |
+
"dextromethorphan",
|
| 487 |
+
"gemcitabine",
|
| 488 |
+
"macrobid",
|
| 489 |
+
"zosyn"
|
| 490 |
+
]
|
| 491 |
+
},
|
| 492 |
+
{
|
| 493 |
+
"cohesion": 0.711,
|
| 494 |
+
"reaction": "mucositis",
|
| 495 |
+
"n_drugs": 4,
|
| 496 |
+
"drugs": [
|
| 497 |
+
"epoch",
|
| 498 |
+
"folfox",
|
| 499 |
+
"melphalan",
|
| 500 |
+
"sutent"
|
| 501 |
+
]
|
| 502 |
+
},
|
| 503 |
+
{
|
| 504 |
+
"cohesion": 0.709,
|
| 505 |
+
"reaction": "transaminitis",
|
| 506 |
+
"n_drugs": 10,
|
| 507 |
+
"drugs": [
|
| 508 |
+
"atorvastatin",
|
| 509 |
+
"augmentin",
|
| 510 |
+
"cephalosporins",
|
| 511 |
+
"lipitor",
|
| 512 |
+
"metformin",
|
| 513 |
+
"methotrexate",
|
| 514 |
+
"seroquel",
|
| 515 |
+
"simvastatin",
|
| 516 |
+
"statin",
|
| 517 |
+
"voriconazole"
|
| 518 |
+
]
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"cohesion": 0.708,
|
| 522 |
+
"reaction": "leukopenia",
|
| 523 |
+
"n_drugs": 9,
|
| 524 |
+
"drugs": [
|
| 525 |
+
"azathioprine",
|
| 526 |
+
"ceftriaxone",
|
| 527 |
+
"imuran",
|
| 528 |
+
"probenecid",
|
| 529 |
+
"revlimid",
|
| 530 |
+
"rifaximin",
|
| 531 |
+
"sunitinib",
|
| 532 |
+
"valgancyclovir",
|
| 533 |
+
"vancomycin"
|
| 534 |
+
]
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"cohesion": 0.708,
|
| 538 |
+
"reaction": "lethargy",
|
| 539 |
+
"n_drugs": 4,
|
| 540 |
+
"drugs": [
|
| 541 |
+
"dilaudid",
|
| 542 |
+
"klonopin",
|
| 543 |
+
"procrit",
|
| 544 |
+
"roxicet"
|
| 545 |
+
]
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"cohesion": 0.705,
|
| 549 |
+
"reaction": "urinary retention",
|
| 550 |
+
"n_drugs": 6,
|
| 551 |
+
"drugs": [
|
| 552 |
+
"benztropine",
|
| 553 |
+
"dilaudid",
|
| 554 |
+
"morphine",
|
| 555 |
+
"opioids",
|
| 556 |
+
"oxycodone",
|
| 557 |
+
"ziconotide"
|
| 558 |
+
]
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"cohesion": 0.702,
|
| 562 |
+
"reaction": "pruritis",
|
| 563 |
+
"n_drugs": 4,
|
| 564 |
+
"drugs": [
|
| 565 |
+
"ceftriaxone",
|
| 566 |
+
"morphine",
|
| 567 |
+
"plavix",
|
| 568 |
+
"telaprevir"
|
| 569 |
+
]
|
| 570 |
+
},
|
| 571 |
+
{
|
| 572 |
+
"cohesion": 0.699,
|
| 573 |
+
"reaction": "hypotension",
|
| 574 |
+
"n_drugs": 14,
|
| 575 |
+
"drugs": [
|
| 576 |
+
"amlodipine",
|
| 577 |
+
"apixaban",
|
| 578 |
+
"atenolol",
|
| 579 |
+
"clonazepam",
|
| 580 |
+
"clonidine",
|
| 581 |
+
"gabapentin",
|
| 582 |
+
"isosorbide dinitrate",
|
| 583 |
+
"lisinopril",
|
| 584 |
+
"losartan",
|
| 585 |
+
"metoprolol",
|
| 586 |
+
"procrit",
|
| 587 |
+
"spironolactone",
|
| 588 |
+
"sunitinib",
|
| 589 |
+
"velcade"
|
| 590 |
+
]
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"cohesion": 0.697,
|
| 594 |
+
"reaction": "cholestatic liver injury",
|
| 595 |
+
"n_drugs": 3,
|
| 596 |
+
"drugs": [
|
| 597 |
+
"ciprofloxacin",
|
| 598 |
+
"clindamycin",
|
| 599 |
+
"diltiazem"
|
| 600 |
+
]
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
"cohesion": 0.695,
|
| 604 |
+
"reaction": "nausea",
|
| 605 |
+
"n_drugs": 33,
|
| 606 |
+
"drugs": [
|
| 607 |
+
"antibiotics",
|
| 608 |
+
"apixaban",
|
| 609 |
+
"atovaquone",
|
| 610 |
+
"augmentin",
|
| 611 |
+
"cephalexin",
|
| 612 |
+
"cladribine",
|
| 613 |
+
"codeine",
|
| 614 |
+
"cytoxan",
|
| 615 |
+
"dilaudid",
|
| 616 |
+
"dipyridamole",
|
| 617 |
+
"dobutamine",
|
| 618 |
+
"doxycycline",
|
| 619 |
+
"folfirinox",
|
| 620 |
+
"gemcitabine",
|
| 621 |
+
"iron supplement",
|
| 622 |
+
"jardiance",
|
| 623 |
+
"macrobid",
|
| 624 |
+
"magnesium citrate",
|
| 625 |
+
"metformin",
|
| 626 |
+
"morphine",
|
| 627 |
+
"mtx",
|
| 628 |
+
"omeprazole",
|
| 629 |
+
"ondansetron",
|
| 630 |
+
"oxycodone",
|
| 631 |
+
"oxycontin",
|
| 632 |
+
"prednisone",
|
| 633 |
+
"prevpac",
|
| 634 |
+
"sunitinib",
|
| 635 |
+
"sutent",
|
| 636 |
+
"tace",
|
| 637 |
+
"verapamil",
|
| 638 |
+
"zofran",
|
| 639 |
+
"zonegran"
|
| 640 |
+
]
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
"cohesion": 0.693,
|
| 644 |
+
"reaction": "acute renal failure",
|
| 645 |
+
"n_drugs": 6,
|
| 646 |
+
"drugs": [
|
| 647 |
+
"allopurinol",
|
| 648 |
+
"chlorthalidone",
|
| 649 |
+
"cytoxan",
|
| 650 |
+
"ibuprofen",
|
| 651 |
+
"lisinopril",
|
| 652 |
+
"metformin"
|
| 653 |
+
]
|
| 654 |
+
},
|
| 655 |
+
{
|
| 656 |
+
"cohesion": 0.691,
|
| 657 |
+
"reaction": "pancytopenia",
|
| 658 |
+
"n_drugs": 10,
|
| 659 |
+
"drugs": [
|
| 660 |
+
"azacytidine",
|
| 661 |
+
"bactrim",
|
| 662 |
+
"bendamustine",
|
| 663 |
+
"cellcept",
|
| 664 |
+
"cyclosporine",
|
| 665 |
+
"decitabine",
|
| 666 |
+
"ibrance",
|
| 667 |
+
"methotrexate",
|
| 668 |
+
"probenecid",
|
| 669 |
+
"tmp-smx"
|
| 670 |
+
]
|
| 671 |
+
},
|
| 672 |
+
{
|
| 673 |
+
"cohesion": 0.689,
|
| 674 |
+
"reaction": "hyponatremia",
|
| 675 |
+
"n_drugs": 6,
|
| 676 |
+
"drugs": [
|
| 677 |
+
"chlorthalidone",
|
| 678 |
+
"cytoxan",
|
| 679 |
+
"hydrochlorothiazide",
|
| 680 |
+
"olanzapine",
|
| 681 |
+
"spironolactone",
|
| 682 |
+
"trileptal"
|
| 683 |
+
]
|
| 684 |
+
},
|
| 685 |
+
{
|
| 686 |
+
"cohesion": 0.688,
|
| 687 |
+
"reaction": "somnolence",
|
| 688 |
+
"n_drugs": 5,
|
| 689 |
+
"drugs": [
|
| 690 |
+
"benzatropine",
|
| 691 |
+
"gabapentin",
|
| 692 |
+
"heroin",
|
| 693 |
+
"morphine",
|
| 694 |
+
"zyprexa"
|
| 695 |
+
]
|
| 696 |
+
},
|
| 697 |
+
{
|
| 698 |
+
"cohesion": 0.684,
|
| 699 |
+
"reaction": "edema",
|
| 700 |
+
"n_drugs": 3,
|
| 701 |
+
"drugs": [
|
| 702 |
+
"casodex",
|
| 703 |
+
"lupron",
|
| 704 |
+
"nifedipine"
|
| 705 |
+
]
|
| 706 |
+
},
|
| 707 |
+
{
|
| 708 |
+
"cohesion": 0.682,
|
| 709 |
+
"reaction": "hypotensive",
|
| 710 |
+
"n_drugs": 4,
|
| 711 |
+
"drugs": [
|
| 712 |
+
"amiodarone",
|
| 713 |
+
"antibiotics",
|
| 714 |
+
"lisinopril",
|
| 715 |
+
"propofol"
|
| 716 |
+
]
|
| 717 |
+
},
|
| 718 |
+
{
|
| 719 |
+
"cohesion": 0.674,
|
| 720 |
+
"reaction": "diarrhea",
|
| 721 |
+
"n_drugs": 18,
|
| 722 |
+
"drugs": [
|
| 723 |
+
"allopurinol",
|
| 724 |
+
"antibiotics",
|
| 725 |
+
"augmentin",
|
| 726 |
+
"bactrim",
|
| 727 |
+
"cefpodoxime",
|
| 728 |
+
"cefuroxime",
|
| 729 |
+
"colace",
|
| 730 |
+
"dronabinol",
|
| 731 |
+
"erythromycin",
|
| 732 |
+
"folfirinox",
|
| 733 |
+
"folfox",
|
| 734 |
+
"irinotecan",
|
| 735 |
+
"lactulose",
|
| 736 |
+
"melphalan",
|
| 737 |
+
"oxaliplatin",
|
| 738 |
+
"prevpac",
|
| 739 |
+
"tamiflu",
|
| 740 |
+
"velcade"
|
| 741 |
+
]
|
| 742 |
+
},
|
| 743 |
+
{
|
| 744 |
+
"cohesion": 0.671,
|
| 745 |
+
"reaction": "peripheral neuropathy",
|
| 746 |
+
"n_drugs": 3,
|
| 747 |
+
"drugs": [
|
| 748 |
+
"epoch",
|
| 749 |
+
"oxaliplatin",
|
| 750 |
+
"vincristine"
|
| 751 |
+
]
|
| 752 |
+
},
|
| 753 |
+
{
|
| 754 |
+
"cohesion": 0.66,
|
| 755 |
+
"reaction": "hyperglycemia",
|
| 756 |
+
"n_drugs": 3,
|
| 757 |
+
"drugs": [
|
| 758 |
+
"prednisone",
|
| 759 |
+
"steroids",
|
| 760 |
+
"tpn"
|
| 761 |
+
]
|
| 762 |
+
},
|
| 763 |
+
{
|
| 764 |
+
"cohesion": 0.653,
|
| 765 |
+
"reaction": "somnolent",
|
| 766 |
+
"n_drugs": 5,
|
| 767 |
+
"drugs": [
|
| 768 |
+
"gabapentin",
|
| 769 |
+
"morphine",
|
| 770 |
+
"oxycodone",
|
| 771 |
+
"quetiapine fumarate",
|
| 772 |
+
"vicodin"
|
| 773 |
+
]
|
| 774 |
+
},
|
| 775 |
+
{
|
| 776 |
+
"cohesion": 0.639,
|
| 777 |
+
"reaction": "nausea and vomiting",
|
| 778 |
+
"n_drugs": 3,
|
| 779 |
+
"drugs": [
|
| 780 |
+
"antibiotics",
|
| 781 |
+
"opioids",
|
| 782 |
+
"prednisone"
|
| 783 |
+
]
|
| 784 |
+
},
|
| 785 |
+
{
|
| 786 |
+
"cohesion": 0.635,
|
| 787 |
+
"reaction": "mental status changes",
|
| 788 |
+
"n_drugs": 3,
|
| 789 |
+
"drugs": [
|
| 790 |
+
"ambien",
|
| 791 |
+
"neurontin",
|
| 792 |
+
"oxycontin"
|
| 793 |
+
]
|
| 794 |
+
},
|
| 795 |
+
{
|
| 796 |
+
"cohesion": 0.631,
|
| 797 |
+
"reaction": "jittery",
|
| 798 |
+
"n_drugs": 3,
|
| 799 |
+
"drugs": [
|
| 800 |
+
"prednisone",
|
| 801 |
+
"risperidone",
|
| 802 |
+
"wellbutrin xr"
|
| 803 |
+
]
|
| 804 |
+
},
|
| 805 |
+
{
|
| 806 |
+
"cohesion": 0.627,
|
| 807 |
+
"reaction": "nauseous",
|
| 808 |
+
"n_drugs": 4,
|
| 809 |
+
"drugs": [
|
| 810 |
+
"levaquin",
|
| 811 |
+
"macrobid",
|
| 812 |
+
"nitroglycerin",
|
| 813 |
+
"percocet"
|
| 814 |
+
]
|
| 815 |
+
},
|
| 816 |
+
{
|
| 817 |
+
"cohesion": 0.61,
|
| 818 |
+
"reaction": "gi upset",
|
| 819 |
+
"n_drugs": 6,
|
| 820 |
+
"drugs": [
|
| 821 |
+
"aspirin",
|
| 822 |
+
"doxycycline",
|
| 823 |
+
"flagyl",
|
| 824 |
+
"ibrance",
|
| 825 |
+
"iron supplement",
|
| 826 |
+
"metformin"
|
| 827 |
+
]
|
| 828 |
+
},
|
| 829 |
+
{
|
| 830 |
+
"cohesion": 0.591,
|
| 831 |
+
"reaction": "increased confusion and somnolence",
|
| 832 |
+
"n_drugs": 3,
|
| 833 |
+
"drugs": [
|
| 834 |
+
"ativan",
|
| 835 |
+
"dicyclomine",
|
| 836 |
+
"gabapentin"
|
| 837 |
+
]
|
| 838 |
+
},
|
| 839 |
+
{
|
| 840 |
+
"cohesion": 0.566,
|
| 841 |
+
"reaction": "loose stools",
|
| 842 |
+
"n_drugs": 4,
|
| 843 |
+
"drugs": [
|
| 844 |
+
"doxycycline",
|
| 845 |
+
"magnesium oxide",
|
| 846 |
+
"naproxen",
|
| 847 |
+
"sunitinib"
|
| 848 |
+
]
|
| 849 |
+
},
|
| 850 |
+
{
|
| 851 |
+
"cohesion": 0.551,
|
| 852 |
+
"reaction": "hyperkalemia",
|
| 853 |
+
"n_drugs": 3,
|
| 854 |
+
"drugs": [
|
| 855 |
+
"kcl",
|
| 856 |
+
"lisinopril",
|
| 857 |
+
"potassium chloride"
|
| 858 |
+
]
|
| 859 |
+
},
|
| 860 |
+
{
|
| 861 |
+
"cohesion": 0.502,
|
| 862 |
+
"reaction": "delirium",
|
| 863 |
+
"n_drugs": 5,
|
| 864 |
+
"drugs": [
|
| 865 |
+
"ambien",
|
| 866 |
+
"benzodiazepine",
|
| 867 |
+
"lithium",
|
| 868 |
+
"oxycodone",
|
| 869 |
+
"prednisone"
|
| 870 |
+
]
|
| 871 |
+
},
|
| 872 |
+
{
|
| 873 |
+
"cohesion": 0.483,
|
| 874 |
+
"reaction": "nausea/vomiting",
|
| 875 |
+
"n_drugs": 3,
|
| 876 |
+
"drugs": [
|
| 877 |
+
"antibiotics",
|
| 878 |
+
"cisplatin",
|
| 879 |
+
"folfirinox"
|
| 880 |
+
]
|
| 881 |
+
},
|
| 882 |
+
{
|
| 883 |
+
"cohesion": 0.453,
|
| 884 |
+
"reaction": "dizzy",
|
| 885 |
+
"n_drugs": 5,
|
| 886 |
+
"drugs": [
|
| 887 |
+
"atenolol",
|
| 888 |
+
"coumadin",
|
| 889 |
+
"insulin",
|
| 890 |
+
"procrit",
|
| 891 |
+
"spironolactone"
|
| 892 |
+
]
|
| 893 |
+
},
|
| 894 |
+
{
|
| 895 |
+
"cohesion": 0.411,
|
| 896 |
+
"reaction": "hypoglycemia",
|
| 897 |
+
"n_drugs": 5,
|
| 898 |
+
"drugs": [
|
| 899 |
+
"glipizide",
|
| 900 |
+
"glyburide",
|
| 901 |
+
"insulin",
|
| 902 |
+
"metformin",
|
| 903 |
+
"nph"
|
| 904 |
+
]
|
| 905 |
+
},
|
| 906 |
+
{
|
| 907 |
+
"cohesion": 0.335,
|
| 908 |
+
"reaction": "hypothyroidism",
|
| 909 |
+
"n_drugs": 3,
|
| 910 |
+
"drugs": [
|
| 911 |
+
"amiodarone",
|
| 912 |
+
"lithium",
|
| 913 |
+
"sunitinib"
|
| 914 |
+
]
|
| 915 |
+
},
|
| 916 |
+
{
|
| 917 |
+
"cohesion": 0.317,
|
| 918 |
+
"reaction": "unresponsive",
|
| 919 |
+
"n_drugs": 3,
|
| 920 |
+
"drugs": [
|
| 921 |
+
"fentanyl",
|
| 922 |
+
"heroin",
|
| 923 |
+
"insulin"
|
| 924 |
+
]
|
| 925 |
+
},
|
| 926 |
+
{
|
| 927 |
+
"cohesion": 0.226,
|
| 928 |
+
"reaction": "diaphoretic",
|
| 929 |
+
"n_drugs": 3,
|
| 930 |
+
"drugs": [
|
| 931 |
+
"insulin",
|
| 932 |
+
"nitroglycerin",
|
| 933 |
+
"vancomycin"
|
| 934 |
+
]
|
| 935 |
+
}
|
| 936 |
+
]
|
requirements.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torch_geometric
|
| 3 |
+
rdkit
|
| 4 |
+
transformers==4.40.2
|
| 5 |
+
fastapi
|
| 6 |
+
uvicorn[standard]
|
| 7 |
+
numpy
|
| 8 |
+
pydantic
|
ssiddi_model.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""SSI-DDI model + featurizer, reconstructed exactly from the training code
|
| 2 |
+
so the uploaded checkpoint loads into it. Used by the Sentinel backend to
|
| 3 |
+
predict drug-drug interactions (with substructure attention) for NOVEL SMILES."""
|
| 4 |
+
import numpy as np, torch
|
| 5 |
+
import torch.nn as nn, torch.nn.functional as F
|
| 6 |
+
from torch_geometric.data import Data, Batch
|
| 7 |
+
from torch_geometric.nn import GATConv, global_mean_pool
|
| 8 |
+
from rdkit import Chem
|
| 9 |
+
|
| 10 |
+
ATOM_FEATURES = 37
|
| 11 |
+
|
| 12 |
+
def atom_features(atom):
|
| 13 |
+
return np.array([
|
| 14 |
+
atom.GetAtomicNum(), atom.GetDegree(), atom.GetFormalCharge(),
|
| 15 |
+
int(atom.GetHybridization()), int(atom.GetIsAromatic()),
|
| 16 |
+
atom.GetTotalNumHs(), atom.GetNumRadicalElectrons(), int(atom.IsInRing()),
|
| 17 |
+
] + [int(atom.IsInRingSize(r)) for r in range(3, 9)] + [0]*23, dtype=np.float32)[:ATOM_FEATURES]
|
| 18 |
+
|
| 19 |
+
def smiles_to_graph(smiles):
|
| 20 |
+
mol = Chem.MolFromSmiles(smiles)
|
| 21 |
+
if mol is None:
|
| 22 |
+
return None
|
| 23 |
+
node_feats = torch.tensor(np.array([atom_features(a) for a in mol.GetAtoms()]), dtype=torch.float)
|
| 24 |
+
edges = []
|
| 25 |
+
for bond in mol.GetBonds():
|
| 26 |
+
i, j = bond.GetBeginAtomIdx(), bond.GetEndAtomIdx()
|
| 27 |
+
edges += [[i, j], [j, i]]
|
| 28 |
+
edge_index = torch.tensor(edges, dtype=torch.long).t().contiguous() if edges else torch.zeros((2, 0), dtype=torch.long)
|
| 29 |
+
return Data(x=node_feats, edge_index=edge_index)
|
| 30 |
+
|
| 31 |
+
class DrugEncoder(nn.Module):
|
| 32 |
+
def __init__(self, in_dim, hidden_dim, out_dim, heads=4):
|
| 33 |
+
super().__init__()
|
| 34 |
+
self.gat1 = GATConv(in_dim, hidden_dim, heads=heads, concat=True, dropout=0.2)
|
| 35 |
+
self.gat2 = GATConv(hidden_dim*heads, out_dim, heads=1, concat=False, dropout=0.2)
|
| 36 |
+
def forward(self, x, edge_index, batch):
|
| 37 |
+
x = F.elu(self.gat1(x, edge_index))
|
| 38 |
+
x = F.elu(self.gat2(x, edge_index))
|
| 39 |
+
return x, global_mean_pool(x, batch)
|
| 40 |
+
|
| 41 |
+
class SubstructureAttention(nn.Module):
|
| 42 |
+
def __init__(self, dim):
|
| 43 |
+
super().__init__()
|
| 44 |
+
self.scale = dim ** -0.5
|
| 45 |
+
self.q = nn.Linear(dim, dim); self.k = nn.Linear(dim, dim); self.v = nn.Linear(dim, dim)
|
| 46 |
+
def forward(self, atoms_a, atoms_b, return_attn=False):
|
| 47 |
+
Q, K, V = self.q(atoms_a), self.k(atoms_b), self.v(atoms_b)
|
| 48 |
+
attn = torch.softmax(Q @ K.T * self.scale, dim=-1)
|
| 49 |
+
out = attn @ V
|
| 50 |
+
return (out, attn) if return_attn else out
|
| 51 |
+
|
| 52 |
+
class SSIDDI(nn.Module):
|
| 53 |
+
def __init__(self, atom_dim=ATOM_FEATURES, hidden=64, out=128):
|
| 54 |
+
super().__init__()
|
| 55 |
+
self.encoder = DrugEncoder(atom_dim, hidden, out)
|
| 56 |
+
self.ssi_ab = SubstructureAttention(out)
|
| 57 |
+
self.ssi_ba = SubstructureAttention(out)
|
| 58 |
+
self.classifier = nn.Sequential(
|
| 59 |
+
nn.Linear(out*4, 256), nn.ReLU(), nn.Dropout(0.3),
|
| 60 |
+
nn.Linear(256, 64), nn.ReLU(),
|
| 61 |
+
nn.Linear(64, 1),
|
| 62 |
+
)
|
| 63 |
+
def forward(self, batch_a, batch_b):
|
| 64 |
+
atoms_a, drug_a = self.encoder(batch_a.x, batch_a.edge_index, batch_a.batch)
|
| 65 |
+
atoms_b, drug_b = self.encoder(batch_b.x, batch_b.edge_index, batch_b.batch)
|
| 66 |
+
feats = []
|
| 67 |
+
for i in range(batch_a.num_graphs):
|
| 68 |
+
aa = atoms_a[batch_a.batch == i]; bb = atoms_b[batch_b.batch == i]
|
| 69 |
+
ab = self.ssi_ab(aa, bb).mean(0); ba = self.ssi_ba(bb, aa).mean(0)
|
| 70 |
+
feats.append(torch.cat([ab, ba], dim=-1))
|
| 71 |
+
ssi = torch.stack(feats)
|
| 72 |
+
combined = torch.cat([drug_a, drug_b, ssi], dim=-1)
|
| 73 |
+
return self.classifier(combined).squeeze(-1)
|
| 74 |
+
|
| 75 |
+
@torch.no_grad()
|
| 76 |
+
def attribution(self, smiles_a, smiles_b):
|
| 77 |
+
"""Return interaction prob + per-atom attention weights (substructure attribution)."""
|
| 78 |
+
self.eval()
|
| 79 |
+
ga, gb = smiles_to_graph(smiles_a), smiles_to_graph(smiles_b)
|
| 80 |
+
if ga is None or gb is None:
|
| 81 |
+
return None
|
| 82 |
+
ba, bb = Batch.from_data_list([ga]), Batch.from_data_list([gb])
|
| 83 |
+
atoms_a, drug_a = self.encoder(ba.x, ba.edge_index, ba.batch)
|
| 84 |
+
atoms_b, drug_b = self.encoder(bb.x, bb.edge_index, bb.batch)
|
| 85 |
+
ab, attn_ab = self.ssi_ab(atoms_a, atoms_b, return_attn=True)
|
| 86 |
+
ba_, attn_ba = self.ssi_ba(atoms_b, atoms_a, return_attn=True)
|
| 87 |
+
ssi = torch.cat([ab.mean(0), ba_.mean(0)], dim=-1).unsqueeze(0)
|
| 88 |
+
combined = torch.cat([drug_a, drug_b, ssi], dim=-1)
|
| 89 |
+
prob = torch.sigmoid(self.classifier(combined).squeeze(-1)).item()
|
| 90 |
+
# atom importance = how much attention each atom receives, aggregated
|
| 91 |
+
a_importance = attn_ab.mean(0).cpu().numpy() # attention drug B atoms get from A? -> use column/row means
|
| 92 |
+
return {
|
| 93 |
+
"prob": prob,
|
| 94 |
+
"a_atom_importance": attn_ba.mean(0).cpu().numpy().tolist(), # A atoms attended by B
|
| 95 |
+
"b_atom_importance": attn_ab.mean(0).cpu().numpy().tolist(), # B atoms attended by A
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
def load_ssiddi(ckpt_path, device="cpu"):
|
| 99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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<title>ClinSift — Real-World Safety Filter</title>
|
| 7 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
|
| 10 |
+
<style>
|
| 11 |
+
:root{
|
| 12 |
+
--bg:#F5F7F8;--panel:#FFFFFF;--paper:#EDF1F3;--inset:#F2F5F6;
|
| 13 |
+
--ink:#0E1B2A;--ink-soft:#51637A;--ink-faint:#8497AB;
|
| 14 |
+
--line:#DCE3E9;--line-soft:#E8EDF1;
|
| 15 |
+
--signal:#0C9C94;--signal-deep:#087F79;--signal-wash:#E2F3F1;
|
| 16 |
+
--ok:#1E9E6A;--ok-wash:#E4F4EC;--mod:#D9922B;--mod-wash:#FBF0DC;
|
| 17 |
+
--high:#DC6031;--high-wash:#FBE8DE;--crit:#C22B44;--crit-wash:#FADFE3;
|
| 18 |
+
--shadow:0 1px 2px rgba(14,27,42,.04),0 8px 24px rgba(14,27,42,.06);--radius:14px;
|
| 19 |
+
}
|
| 20 |
+
*{box-sizing:border-box}html{-webkit-text-size-adjust:100%}
|
| 21 |
+
body{margin:0;background:var(--bg);color:var(--ink);font-family:"Inter",system-ui,sans-serif;
|
| 22 |
+
font-size:15px;line-height:1.55;-webkit-font-smoothing:antialiased}
|
| 23 |
+
.wrap{max-width:1180px;margin:0 auto;padding:0 24px}
|
| 24 |
+
header{position:sticky;top:0;z-index:50;background:rgba(245,247,248,.82);
|
| 25 |
+
backdrop-filter:saturate(140%) blur(10px);border-bottom:1px solid var(--line)}
|
| 26 |
+
.head-in{display:flex;align-items:center;gap:16px;height:58px}
|
| 27 |
+
.logo{display:flex;align-items:center;gap:10px;font-family:"Space Grotesk";font-weight:700;
|
| 28 |
+
letter-spacing:-.02em;font-size:17px}
|
| 29 |
+
.mark{width:24px;height:24px;border-radius:7px;background:conic-gradient(from 210deg,var(--signal),var(--signal-deep) 55%,#0b6f6a);
|
| 30 |
+
position:relative;flex:none;box-shadow:inset 0 0 0 1px rgba(255,255,255,.25)}
|
| 31 |
+
.mark::after{content:"";position:absolute;inset:6px;border-radius:3px;border:1.5px solid rgba(255,255,255,.9);
|
| 32 |
+
border-right-color:transparent;animation:spin 3.4s linear infinite}
|
| 33 |
+
@keyframes spin{to{transform:rotate(360deg)}}
|
| 34 |
+
.tagword{color:var(--ink-faint);font-size:12.5px;font-weight:500;margin-left:2px}
|
| 35 |
+
.head-spacer{flex:1}
|
| 36 |
+
.conn{display:flex;align-items:center;gap:8px;font-family:"IBM Plex Mono";font-size:11.5px;color:var(--ink-soft)}
|
| 37 |
+
.conn input{font-family:"IBM Plex Mono";font-size:11.5px;border:1px solid var(--line);border-radius:7px;
|
| 38 |
+
padding:5px 8px;width:170px;color:var(--ink);background:var(--panel)}
|
| 39 |
+
.cdotH{width:7px;height:7px;border-radius:50%;background:var(--ink-faint);flex:none}
|
| 40 |
+
.cdotH.up{background:var(--ok);box-shadow:0 0 0 3px var(--ok-wash)}
|
| 41 |
+
.cdotH.down{background:var(--crit);box-shadow:0 0 0 3px var(--crit-wash)}
|
| 42 |
+
|
| 43 |
+
.hero{padding:44px 0 24px}
|
| 44 |
+
.eyebrow{font-family:"IBM Plex Mono";font-size:12px;letter-spacing:.12em;text-transform:uppercase;
|
| 45 |
+
color:var(--signal-deep);margin:0 0 14px}
|
| 46 |
+
h1{font-family:"Space Grotesk";font-weight:600;font-size:clamp(28px,4.4vw,46px);line-height:1.04;
|
| 47 |
+
letter-spacing:-.025em;margin:0 0 16px;max-width:16.5ch}
|
| 48 |
+
h1 em{font-style:normal;color:var(--signal-deep)}
|
| 49 |
+
.sub{font-size:16.5px;color:var(--ink-soft);max-width:60ch;margin:0 0 26px}
|
| 50 |
+
|
| 51 |
+
.modebar{display:inline-flex;background:var(--paper);border:1px solid var(--line);border-radius:10px;
|
| 52 |
+
padding:3px;margin-bottom:14px;gap:2px}
|
| 53 |
+
.modebtn{font-family:"Space Grotesk";font-weight:600;font-size:12.5px;color:var(--ink-soft);
|
| 54 |
+
background:transparent;border:0;padding:7px 15px;border-radius:8px;cursor:pointer}
|
| 55 |
+
.modebtn.on{background:var(--panel);color:var(--signal-deep);box-shadow:var(--shadow)}
|
| 56 |
+
.query{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);
|
| 57 |
+
box-shadow:var(--shadow);padding:8px;display:flex;gap:8px;align-items:center;max-width:760px}
|
| 58 |
+
.query input{flex:1;border:0;outline:0;background:transparent;font-family:"IBM Plex Mono";
|
| 59 |
+
font-size:15px;color:var(--ink);padding:12px}
|
| 60 |
+
.query input::placeholder{color:var(--ink-faint)}
|
| 61 |
+
.screen-btn{font-family:"Space Grotesk";font-weight:600;font-size:14.5px;color:#fff;
|
| 62 |
+
background:var(--signal-deep);border:0;border-radius:9px;padding:12px 20px;cursor:pointer;
|
| 63 |
+
display:inline-flex;align-items:center;gap:8px}
|
| 64 |
+
.screen-btn:hover{background:#0b6f6a}.screen-btn svg{width:15px;height:15px}
|
| 65 |
+
.chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;max-width:760px}
|
| 66 |
+
.chip{font-family:"IBM Plex Mono";font-size:12.5px;color:var(--ink-soft);background:var(--panel);
|
| 67 |
+
border:1px solid var(--line);border-radius:20px;padding:7px 13px;cursor:pointer;transition:.14s}
|
| 68 |
+
.chip:hover{border-color:var(--signal);color:var(--signal-deep);background:var(--signal-wash)}
|
| 69 |
+
.chip .op{color:var(--ink-faint)}
|
| 70 |
+
.chip.smiles{border-style:dashed}
|
| 71 |
+
|
| 72 |
+
.result{padding:6px 0 60px;opacity:0;transform:translateY(8px);transition:.4s}
|
| 73 |
+
.result.show{opacity:1;transform:none}
|
| 74 |
+
.banner{background:var(--mod-wash);border:1px solid #F0DEB8;color:#8a5b18;border-radius:11px;
|
| 75 |
+
padding:11px 15px;font-size:13px;margin-bottom:16px;display:flex;gap:9px;align-items:flex-start}
|
| 76 |
+
.banner svg{width:16px;height:16px;flex:none;margin-top:1px}
|
| 77 |
+
|
| 78 |
+
.gate{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);
|
| 79 |
+
padding:22px 24px;margin-bottom:22px;position:relative;overflow:hidden}
|
| 80 |
+
.gate-grid{display:grid;grid-template-columns:auto 1fr auto;gap:26px;align-items:center}
|
| 81 |
+
.compound{min-width:150px;max-width:210px}
|
| 82 |
+
.field-label{font-family:"IBM Plex Mono";font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;
|
| 83 |
+
color:var(--ink-faint);margin-bottom:7px}
|
| 84 |
+
.compound-name{font-family:"Space Grotesk";font-weight:600;font-size:20px;letter-spacing:-.02em;
|
| 85 |
+
line-height:1.15;word-break:break-word}
|
| 86 |
+
.compound-meta{font-size:12.5px;color:var(--ink-soft);margin-top:3px}
|
| 87 |
+
.channels{display:flex;gap:10px;position:relative}
|
| 88 |
+
.channels::before{content:"";position:absolute;left:0;right:0;top:50%;height:1px;
|
| 89 |
+
background:repeating-linear-gradient(90deg,var(--line) 0 6px,transparent 6px 12px)}
|
| 90 |
+
.chan{flex:1;background:var(--inset);border:1px solid var(--line-soft);border-radius:11px;
|
| 91 |
+
padding:11px 10px 10px;text-align:center;position:relative;z-index:1;min-width:0}
|
| 92 |
+
.chan .cdot{width:11px;height:11px;border-radius:50%;margin:0 auto 8px;background:var(--ink-faint)}
|
| 93 |
+
.chan.s-none .cdot{background:var(--ok);box-shadow:0 0 0 4px var(--ok-wash)}
|
| 94 |
+
.chan.s-mod .cdot{background:var(--mod);box-shadow:0 0 0 4px var(--mod-wash)}
|
| 95 |
+
.chan.s-high .cdot{background:var(--high);box-shadow:0 0 0 4px var(--high-wash)}
|
| 96 |
+
.chan.s-crit .cdot{background:var(--crit);box-shadow:0 0 0 4px var(--crit-wash)}
|
| 97 |
+
.chan.s-off .cdot{background:var(--ink-faint);opacity:.4}
|
| 98 |
+
.chan-name{font-size:11px;font-weight:600;color:var(--ink);line-height:1.2}
|
| 99 |
+
.chan-val{font-family:"IBM Plex Mono";font-size:10.5px;color:var(--ink-soft);margin-top:3px}
|
| 100 |
+
.verdict{min-width:150px;text-align:center}
|
| 101 |
+
.stamp{display:inline-block;font-family:"Space Grotesk";font-weight:700;font-size:22px;letter-spacing:.02em;
|
| 102 |
+
padding:12px 20px;border-radius:11px;border:2px solid currentColor}
|
| 103 |
+
.stamp small{display:block;font-family:"IBM Plex Mono";font-weight:400;font-size:10px;letter-spacing:.06em;
|
| 104 |
+
margin-top:4px;opacity:.75}
|
| 105 |
+
.v-pass{color:var(--ok);background:var(--ok-wash)}.v-flag{color:var(--high);background:var(--high-wash)}
|
| 106 |
+
.v-hold{color:var(--crit);background:var(--crit-wash)}
|
| 107 |
+
.verdict-reason{font-size:12.5px;color:var(--ink-soft);margin-top:10px;max-width:180px;margin-left:auto;margin-right:auto}
|
| 108 |
+
|
| 109 |
+
.cols{display:grid;grid-template-columns:1fr 380px;gap:22px;align-items:start}
|
| 110 |
+
.sec-title{font-family:"Space Grotesk";font-weight:600;font-size:13px;color:var(--ink);margin:0 0 12px;
|
| 111 |
+
display:flex;align-items:center;gap:9px}
|
| 112 |
+
.sec-title .n{font-family:"IBM Plex Mono";font-size:11px;color:var(--ink-faint)}
|
| 113 |
+
.signals{display:flex;flex-direction:column;gap:12px}
|
| 114 |
+
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
|
| 115 |
+
.card-h{display:flex;align-items:center;gap:11px;padding:14px 16px;border-bottom:1px solid var(--line-soft)}
|
| 116 |
+
.cat-ic{width:30px;height:30px;border-radius:8px;flex:none;display:grid;place-items:center;
|
| 117 |
+
background:var(--signal-wash);color:var(--signal-deep)}
|
| 118 |
+
.cat-ic svg{width:16px;height:16px}
|
| 119 |
+
.cat-name{font-family:"Space Grotesk";font-weight:600;font-size:14.5px}
|
| 120 |
+
.cat-sub{font-size:12px;color:var(--ink-faint);margin-top:1px}
|
| 121 |
+
.sev-tag{margin-left:auto;font-family:"IBM Plex Mono";font-size:10.5px;font-weight:500;padding:4px 9px;
|
| 122 |
+
border-radius:6px;text-transform:uppercase;white-space:nowrap}
|
| 123 |
+
.t-none{color:var(--ok);background:var(--ok-wash)}.t-mod{color:var(--mod);background:var(--mod-wash)}
|
| 124 |
+
.t-high{color:var(--high);background:var(--high-wash)}.t-crit{color:var(--crit);background:var(--crit-wash)}
|
| 125 |
+
.t-na{color:var(--ink-faint);background:var(--inset)}
|
| 126 |
+
.findings{padding:6px 16px 14px}
|
| 127 |
+
.finding{display:flex;gap:12px;padding:11px 0;border-bottom:1px dashed var(--line-soft)}
|
| 128 |
+
.finding:last-child{border-bottom:0}
|
| 129 |
+
.f-bar{width:3px;border-radius:2px;flex:none;background:var(--ink-faint)}
|
| 130 |
+
.finding.f-none .f-bar{background:var(--ok)}.finding.f-mod .f-bar{background:var(--mod)}
|
| 131 |
+
.finding.f-high .f-bar{background:var(--high)}.finding.f-crit .f-bar{background:var(--crit)}
|
| 132 |
+
.f-title{font-size:13.5px;font-weight:600}.f-title .arrow{color:var(--ink-faint);margin:0 5px}
|
| 133 |
+
.f-note{font-size:12.5px;color:var(--ink-soft);margin-top:2px}
|
| 134 |
+
.f-meta{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
|
| 135 |
+
.meta{font-family:"IBM Plex Mono";font-size:10.5px;padding:3px 8px;border-radius:5px;background:var(--inset);
|
| 136 |
+
color:var(--ink-soft);border:1px solid var(--line-soft)}
|
| 137 |
+
.meta.obs{color:var(--signal-deep);background:var(--signal-wash);border-color:#C6E7E4}
|
| 138 |
+
.meta.pred{color:var(--mod);background:var(--mod-wash);border-color:#F0DEB8}
|
| 139 |
+
.card-empty{padding:18px 16px;font-size:13px;color:var(--ink-faint);display:flex;gap:9px;align-items:center}
|
| 140 |
+
.card-empty svg{width:16px;height:16px;color:var(--ok)}
|
| 141 |
+
|
| 142 |
+
.aside{position:sticky;top:74px;display:flex;flex-direction:column;gap:14px}
|
| 143 |
+
.api{background:#0d1a29;border:1px solid #16263a;border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
|
| 144 |
+
.api-h{display:flex;align-items:center;gap:9px;padding:11px 14px;border-bottom:1px solid #16263a}
|
| 145 |
+
.api-h .dotrow{display:flex;gap:6px}.api-h .dotrow i{width:9px;height:9px;border-radius:50%;display:block}
|
| 146 |
+
.api-h .dotrow i:nth-child(1){background:#e05f52}.api-h .dotrow i:nth-child(2){background:#e0b23a}.api-h .dotrow i:nth-child(3){background:#3ab06a}
|
| 147 |
+
.api-h .path{font-family:"IBM Plex Mono";font-size:11.5px;color:#7d96b1;margin-left:4px}
|
| 148 |
+
.api-h .verb{font-family:"IBM Plex Mono";font-size:10px;color:#0d1a29;background:var(--signal);padding:2px 6px;border-radius:4px;margin-left:auto}
|
| 149 |
+
.api pre{margin:0;padding:15px 16px;font-family:"IBM Plex Mono";font-size:11.5px;line-height:1.65;color:#c7d6e6;overflow-x:auto;max-height:330px}
|
| 150 |
+
.api .k{color:#6fd1c9}.api .s{color:#9fd0a0}.api .n{color:#e0b26a}.api .b{color:#d98f6a}.api .c{color:#5a7891}
|
| 151 |
+
.snippet{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
|
| 152 |
+
.snip-h{padding:11px 14px;border-bottom:1px solid var(--line-soft);font-family:"Space Grotesk";font-weight:600;
|
| 153 |
+
font-size:12.5px;display:flex;align-items:center;gap:8px}
|
| 154 |
+
.snip-h svg{width:14px;height:14px;color:var(--signal-deep)}
|
| 155 |
+
.snippet pre{margin:0;padding:14px 16px;font-family:"IBM Plex Mono";font-size:11.5px;line-height:1.7;color:var(--ink);overflow-x:auto}
|
| 156 |
+
.snippet .kw{color:var(--crit)}.snippet .fn{color:var(--signal-deep)}.snippet .st{color:var(--ok)}.snippet .cm{color:var(--ink-faint)}
|
| 157 |
+
.provenance{background:var(--paper);border:1px solid var(--line);border-radius:var(--radius);padding:15px 16px}
|
| 158 |
+
.provenance h4{font-family:"Space Grotesk";font-size:12.5px;margin:0 0 10px;font-weight:600}
|
| 159 |
+
.prov-row{display:flex;justify-content:space-between;font-size:12px;padding:5px 0;border-bottom:1px dashed var(--line);color:var(--ink-soft)}
|
| 160 |
+
.prov-row:last-child{border-bottom:0}.prov-row b{font-family:"IBM Plex Mono";color:var(--ink);font-weight:500}
|
| 161 |
+
|
| 162 |
+
.attrib{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);
|
| 163 |
+
overflow:hidden;margin-top:12px}
|
| 164 |
+
.attrib-h{display:flex;align-items:center;gap:11px;padding:14px 16px;border-bottom:1px solid var(--line-soft)}
|
| 165 |
+
.attrib-body{display:grid;grid-template-columns:auto 1fr;gap:16px;padding:16px;align-items:center}
|
| 166 |
+
.mol{background:var(--inset);border:1px solid var(--line-soft);border-radius:11px;padding:6px;width:340px;max-width:100%}
|
| 167 |
+
.mol svg{display:block;width:100%;height:auto}
|
| 168 |
+
.attrib-legend{min-width:0}
|
| 169 |
+
.heat{display:flex;align-items:center;gap:8px;font-family:"IBM Plex Mono";font-size:10.5px;color:var(--ink-faint);margin-bottom:10px}
|
| 170 |
+
.heat i{flex:1;height:8px;border-radius:4px;background:linear-gradient(90deg,#E6F2F0,#FF9E5E,#F04E37)}
|
| 171 |
+
.attrib-atoms{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
|
| 172 |
+
.attrib-note{font-size:12px;color:var(--ink-soft);margin:0;line-height:1.5}
|
| 173 |
+
@media (max-width:560px){.attrib-body{grid-template-columns:1fr}.mol{width:100%}}
|
| 174 |
+
|
| 175 |
+
footer{border-top:1px solid var(--line);padding:26px 0 46px;color:var(--ink-faint);font-size:12.5px}
|
| 176 |
+
footer .wrap{display:flex;flex-wrap:wrap;gap:22px;justify-content:space-between}
|
| 177 |
+
footer p{margin:0;max-width:62ch;line-height:1.6}footer b{color:var(--ink-soft);font-weight:600}
|
| 178 |
+
.legend{display:flex;gap:14px;flex-wrap:wrap}
|
| 179 |
+
.legend span{display:inline-flex;align-items:center;gap:6px;font-family:"IBM Plex Mono";font-size:11px}
|
| 180 |
+
.lg{width:9px;height:9px;border-radius:50%}
|
| 181 |
+
@media (max-width:920px){.cols{grid-template-columns:1fr}.aside{position:static}
|
| 182 |
+
.gate-grid{grid-template-columns:1fr;gap:18px}.channels{order:3}.verdict{order:2;text-align:left}.verdict-reason{margin-left:0}}
|
| 183 |
+
@media (max-width:560px){.channels{flex-wrap:wrap}.chan{flex:1 1 44%}.query{flex-wrap:wrap}.query input{flex:1 1 100%}.screen-btn{flex:1}
|
| 184 |
+
.conn input{width:120px}}
|
| 185 |
+
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
|
| 186 |
+
:focus-visible{outline:2px solid var(--signal);outline-offset:2px;border-radius:6px}
|
| 187 |
+
</style>
|
| 188 |
+
</head>
|
| 189 |
+
<body>
|
| 190 |
+
<header><div class="wrap head-in">
|
| 191 |
+
<div class="logo"><span class="mark"></span>ClinSift<span class="tagword">/ real-world safety filter</span></div>
|
| 192 |
+
<div class="head-spacer"></div>
|
| 193 |
+
<div class="conn"><span class="cdotH" id="hdot"></span>
|
| 194 |
+
<input id="backend" value="http://localhost:8000" aria-label="Backend URL" spellcheck="false"></div>
|
| 195 |
+
</div></header>
|
| 196 |
+
|
| 197 |
+
<main class="wrap">
|
| 198 |
+
<section class="hero">
|
| 199 |
+
<p class="eyebrow">Pre-clinical & clinical safety screening</p>
|
| 200 |
+
<h1>Screen any drug against <em>patient-level</em> adverse-event signals.</h1>
|
| 201 |
+
<p class="sub">Sentinel mines reactions, allergies, cross-reactivity and interactions from real clinical
|
| 202 |
+
notes and returns one gate decision your pipeline can act on. Screen a known drug for observed evidence,
|
| 203 |
+
or a novel compound by structure — the models run live.</p>
|
| 204 |
+
|
| 205 |
+
<div class="modebar" role="tablist">
|
| 206 |
+
<button class="modebtn on" id="m-name" role="tab">By name</button>
|
| 207 |
+
<button class="modebtn" id="m-smiles" role="tab">By structure (SMILES)</button>
|
| 208 |
+
</div>
|
| 209 |
+
<div class="query" role="search">
|
| 210 |
+
<input id="q" type="text" autocomplete="off" spellcheck="false"
|
| 211 |
+
placeholder="drug name —or— drug A + drug B" aria-label="Query" />
|
| 212 |
+
<button class="screen-btn" id="run">
|
| 213 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.3-4.3"/></svg>
|
| 214 |
+
Screen</button>
|
| 215 |
+
</div>
|
| 216 |
+
<div class="chips" id="chips"></div>
|
| 217 |
+
</section>
|
| 218 |
+
<section class="result" id="result" aria-live="polite"></section>
|
| 219 |
+
</main>
|
| 220 |
+
|
| 221 |
+
<footer><div class="wrap">
|
| 222 |
+
<p><b>How to read this.</b> Signals marked <b>observed</b> come from documented reactions in real EHR notes —
|
| 223 |
+
the differentiator over structure-only databases. Signals marked <b>predicted</b> come from the models
|
| 224 |
+
(MoLFormer structural similarity + the SSI-DDI interaction model) and apply to compounds not in the record.
|
| 225 |
+
Allergy cross-reactivity is patient-anchored and unavailable for novel compounds. Tuned for specificity:
|
| 226 |
+
chemically unrelated co-occurrences are reported low, not as warnings.</p>
|
| 227 |
+
<div class="legend">
|
| 228 |
+
<span><i class="lg" style="background:var(--ok)"></i>clear</span>
|
| 229 |
+
<span><i class="lg" style="background:var(--mod)"></i>monitor</span>
|
| 230 |
+
<span><i class="lg" style="background:var(--high)"></i>warning</span>
|
| 231 |
+
<span><i class="lg" style="background:var(--crit)"></i>contraindication</span>
|
| 232 |
+
</div>
|
| 233 |
+
</div></footer>
|
| 234 |
+
|
| 235 |
+
<script>
|
| 236 |
+
let MODE="name";
|
| 237 |
+
const $=id=>document.getElementById(id);
|
| 238 |
+
const backend=()=>$("backend").value.replace(/\/+$/,"");
|
| 239 |
+
const esc=s=>String(s).replace(/[&<>]/g,c=>({'&':'&','<':'<','>':'>'}[c]));
|
| 240 |
+
const SEV={none:"Clear",mod:"Monitor",high:"Warning",crit:"Contraindication"};
|
| 241 |
+
const RANK={none:0,mod:1,high:2,crit:3};
|
| 242 |
+
const CAT_ICON={
|
| 243 |
+
ddi:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 6a4 4 0 0 0 0 8h1"/><path d="M16 18a4 4 0 0 0 0-8h-1"/><path d="M9 10h6"/></svg>',
|
| 244 |
+
xreact:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="7" cy="7" r="3"/><circle cx="17" cy="17" r="3"/><path d="M9.5 9.5l5 5"/></svg>',
|
| 245 |
+
side:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 3l9 16H3z"/><path d="M12 10v4"/><circle cx="12" cy="17" r=".5" fill="currentColor"/></svg>',
|
| 246 |
+
allergy:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 21s-7-4.6-7-10a4 4 0 0 1 7-2.6A4 4 0 0 1 19 11c0 5.4-7 10-7 10z"/></svg>'};
|
| 247 |
+
|
| 248 |
+
/* ---- health check ---- */
|
| 249 |
+
async function health(){
|
| 250 |
+
try{const r=await fetch(backend()+"/health");const j=await r.json();
|
| 251 |
+
$("hdot").className="cdotH up";$("hdot").title=`connected · ${j.drugs} drugs · MoLFormer ${j.molformer?'on':'off'}`;
|
| 252 |
+
return j;
|
| 253 |
+
}catch(e){$("hdot").className="cdotH down";$("hdot").title="backend not reachable";return null;}
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
/* ---- query dispatch ---- */
|
| 257 |
+
async function go(){
|
| 258 |
+
const raw=$("q").value.trim();if(!raw)return;
|
| 259 |
+
const el=$("result");el.innerHTML=loading();el.classList.add("show");
|
| 260 |
+
let url,payload;
|
| 261 |
+
if(MODE==="smiles"){url="/screen_smiles";payload={smiles:raw};}
|
| 262 |
+
else{const parts=raw.split("+").map(s=>s.trim()).filter(Boolean);
|
| 263 |
+
url="/screen";payload=parts.length>=2?{drug_a:parts[0],drug_b:parts[1]}:{drug:parts[0]};}
|
| 264 |
+
try{
|
| 265 |
+
const r=await fetch(backend()+url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload)});
|
| 266 |
+
const j=await r.json();
|
| 267 |
+
if(j.error){el.innerHTML=errCard(j.error);return;}
|
| 268 |
+
render(j,url,payload);
|
| 269 |
+
}catch(e){el.innerHTML=errCard("Can’t reach the backend at "+backend()+". Start it with: uvicorn app:app --port 8000");}
|
| 270 |
+
}
|
| 271 |
+
function loading(){return `<div class="gate"><div class="card-empty">Screening…</div></div>`;}
|
| 272 |
+
function errCard(msg){return `<div class="gate"><div class="card-empty">
|
| 273 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="var(--mod)" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M12 8v4M12 16v.5"/></svg>
|
| 274 |
+
<span>${esc(msg)}</span></div></div>`;}
|
| 275 |
+
|
| 276 |
+
/* ---- render ---- */
|
| 277 |
+
function render(res,url,payload){
|
| 278 |
+
const el=$("result");
|
| 279 |
+
const vclass={PASS:"v-pass",FLAG:"v-flag",HOLD:"v-hold"}[res.verdict];
|
| 280 |
+
const vsub={PASS:"gate · clear",FLAG:"gate · warn",HOLD:"gate · block"}[res.verdict];
|
| 281 |
+
|
| 282 |
+
const channels=res.categories.map(c=>{
|
| 283 |
+
const r=Math.max(0,...c.items.map(i=>RANK[i.sev]));
|
| 284 |
+
const has=c.items.some(i=>i.sev!=="none");
|
| 285 |
+
const sv=has?["none","mod","high","crit"][r]:"off";
|
| 286 |
+
const short={ddi:"DDI",xreact:"X-react",side:"Adverse",allergy:"Allergy"}[c.key];
|
| 287 |
+
const val=has?SEV[["none","mod","high","crit"][r]]:"—";
|
| 288 |
+
return `<div class="chan s-${sv}"><div class="cdot"></div><div class="chan-name">${short}</div><div class="chan-val">${val}</div></div>`;
|
| 289 |
+
}).join("");
|
| 290 |
+
|
| 291 |
+
const cards=res.categories.map(c=>{
|
| 292 |
+
const real=c.items.filter(i=>i.sev!=="none");
|
| 293 |
+
const r=Math.max(0,...real.map(i=>RANK[i.sev]));
|
| 294 |
+
const sv=["none","mod","high","crit"][r];
|
| 295 |
+
let tag,body;
|
| 296 |
+
const naAllergy=((res.mode==="novel"||res.allergy_available===false)&&c.key==="allergy");
|
| 297 |
+
if(naAllergy){
|
| 298 |
+
const why = res.mode==="novel"
|
| 299 |
+
? "Patient-anchored — unavailable for a compound not yet in the clinical record."
|
| 300 |
+
: "Patient-anchored allergy data isn’t loaded in this deployment (excluded from the public build for data-use compliance).";
|
| 301 |
+
tag=`<span class="sev-tag t-na">N/A · needs patient data</span>`;
|
| 302 |
+
body=`<div class="card-empty" style="color:var(--ink-faint)">
|
| 303 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="var(--ink-faint)" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M12 8v4"/></svg>
|
| 304 |
+
${why}</div>`;
|
| 305 |
+
}else if(!real.length){
|
| 306 |
+
tag=`<span class="sev-tag t-none">Clear</span>`;
|
| 307 |
+
body=`<div class="card-empty"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20 6L9 17l-5-5"/></svg>No signal in this category.</div>`;
|
| 308 |
+
}else{
|
| 309 |
+
tag=`<span class="sev-tag t-${sv}">${SEV[sv]}</span>`;
|
| 310 |
+
body=`<div class="findings">`+real.map(f=>{
|
| 311 |
+
const ev=f.ev==="observed"?`<span class="meta obs">observed${f.pt?` · ${f.pt} pt`:''}</span>`:`<span class="meta pred">predicted</span>`;
|
| 312 |
+
return `<div class="finding f-${f.sev}"><div class="f-bar"></div><div class="f-body">
|
| 313 |
+
<div class="f-title">${esc(f.find)}${f.to?`<span class="arrow">→</span>${esc(f.to)}`:""}</div>
|
| 314 |
+
<div class="f-note">${esc(f.note)}</div>
|
| 315 |
+
<div class="f-meta">${ev}<span class="meta">conf ${Number(f.conf).toFixed(2)}</span>${f.src?`<span class="meta">${esc(f.src)}</span>`:""}</div>
|
| 316 |
+
</div></div>`;}).join("")+`</div>`;
|
| 317 |
+
}
|
| 318 |
+
return `<div class="card"><div class="card-h"><div class="cat-ic">${CAT_ICON[c.key]}</div>
|
| 319 |
+
<div><div class="cat-name">${c.name}</div><div class="cat-sub">${c.sub}</div></div>${tag}</div>${body}</div>`;
|
| 320 |
+
}).join("");
|
| 321 |
+
|
| 322 |
+
const mfBanner=(res.mode==="novel"&&res.molformer_available===false)?
|
| 323 |
+
`<div class="banner"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="9"/><path d="M12 8v4M12 16v.5"/></svg>
|
| 324 |
+
<span>MoLFormer isn’t loaded in this runtime, so structural cross-reactivity/side-effect prediction is limited to the interaction model. Start the backend in an environment with model access to enable the full novel-compound screen.</span></div>`:"";
|
| 325 |
+
|
| 326 |
+
const attr=res.attribution;
|
| 327 |
+
const attrPanel=attr?`<div class="attrib">
|
| 328 |
+
<div class="attrib-h"><div class="cat-ic">${CAT_ICON.xreact}</div>
|
| 329 |
+
<div><div class="cat-name">Substructure attribution</div>
|
| 330 |
+
<div class="cat-sub">atoms driving the predicted interaction with ${esc(attr.partner)}</div></div>
|
| 331 |
+
<span class="sev-tag t-high">p ${Number(attr.prob).toFixed(2)}</span></div>
|
| 332 |
+
<div class="attrib-body">
|
| 333 |
+
<div class="mol">${attr.svg}</div>
|
| 334 |
+
<div class="attrib-legend">
|
| 335 |
+
<div class="heat"><span>low</span><i></i><span>high</span></div>
|
| 336 |
+
<div class="attrib-atoms">${attr.top_atoms.map(a=>`<span class="meta">${a.symbol} · ${Number(a.importance).toFixed(2)}</span>`).join("")}</div>
|
| 337 |
+
<p class="attrib-note">The model attends to these atoms when predicting the interaction — a substructure-level explanation, not just a score.</p>
|
| 338 |
+
</div></div></div>`:"";
|
| 339 |
+
|
| 340 |
+
el.innerHTML=`${mfBanner}
|
| 341 |
+
<div class="gate"><div class="gate-grid">
|
| 342 |
+
<div class="compound"><div class="field-label">${res.subject.pair?"Compound pair":(res.mode==="novel"?"Novel compound":"Compound")}</div>
|
| 343 |
+
<div class="compound-name">${esc(res.subject.name)}</div><div class="compound-meta">${esc(res.subject.meta)}</div></div>
|
| 344 |
+
<div class="channels">${channels}</div>
|
| 345 |
+
<div class="verdict"><div class="field-label">Gate decision</div>
|
| 346 |
+
<div class="stamp ${vclass}">${res.verdict}<small>${vsub}</small></div>
|
| 347 |
+
<div class="verdict-reason">${esc(res.reason)}</div></div>
|
| 348 |
+
</div></div>
|
| 349 |
+
<div class="cols">
|
| 350 |
+
<div><div class="sec-title"><span class="n">01</span>Signal breakdown</div><div class="signals">${cards}</div>${attrPanel}</div>
|
| 351 |
+
<div class="aside">
|
| 352 |
+
<div class="sec-title"><span class="n">02</span>Pipeline output</div>
|
| 353 |
+
${apiPanel(res,url,payload)}${snippetPanel(res,url,payload)}${provPanel(res)}
|
| 354 |
+
</div>
|
| 355 |
+
</div>`;
|
| 356 |
+
el.classList.remove("show");void el.offsetWidth;el.classList.add("show");
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
function apiPanel(res,url,payload){
|
| 360 |
+
const sig=res.signals.map(s=>
|
| 361 |
+
` <span class="b">{</span> <span class="k">"category"</span>:<span class="s">"${s.category}"</span>, <span class="k">"severity"</span>:<span class="s">"${s.severity}"</span>,
|
| 362 |
+
<span class="k">"finding"</span>:<span class="s">"${esc(s.finding)}"</span>, <span class="k">"evidence"</span>:<span class="s">"${s.evidence}"</span>,
|
| 363 |
+
<span class="k">"patient_support"</span>:<span class="n">${s.patient_support}</span>, <span class="k">"confidence"</span>:<span class="n">${Number(s.confidence).toFixed(2)}</span> <span class="b">}</span>`).join(",\n");
|
| 364 |
+
const body=`<span class="b">{</span>
|
| 365 |
+
<span class="k">"query"</span>: <span class="s">"${esc(res.query)}"</span>,
|
| 366 |
+
<span class="k">"verdict"</span>: <span class="s">"${res.verdict}"</span>,
|
| 367 |
+
<span class="k">"gate_action"</span>: <span class="s">"${res.gate_action}"</span>,
|
| 368 |
+
<span class="k">"max_severity"</span>: <span class="s">"${res.max_severity}"</span>,
|
| 369 |
+
<span class="k">"signals"</span>: <span class="b">[</span>
|
| 370 |
+
${sig||' <span class="c">/* none above threshold */</span>'}
|
| 371 |
+
<span class="b">]</span>,
|
| 372 |
+
<span class="k">"provenance"</span>: <span class="s">"${esc(res.provenance)}"</span>
|
| 373 |
+
<span class="b">}</span>`;
|
| 374 |
+
return `<div class="api"><div class="api-h"><div class="dotrow"><i></i><i></i><i></i></div>
|
| 375 |
+
<span class="path">POST ${url}</span><span class="verb">200 OK</span></div><pre>${body}</pre></div>`;
|
| 376 |
+
}
|
| 377 |
+
function snippetPanel(res,url,payload){
|
| 378 |
+
const call=url==="/screen_smiles"
|
| 379 |
+
?`sentinel.<span class="fn">screen_smiles</span>(smiles=<span class="st">"${esc(payload.smiles).slice(0,22)}…"</span>)`
|
| 380 |
+
:(payload.drug_a?`sentinel.<span class="fn">screen</span>(drug_a=<span class="st">"${payload.drug_a}"</span>, drug_b=<span class="st">"${payload.drug_b}"</span>)`
|
| 381 |
+
:`sentinel.<span class="fn">screen</span>(drug=<span class="st">"${payload.drug}"</span>)`);
|
| 382 |
+
return `<div class="snippet"><div class="snip-h">
|
| 383 |
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 9l-4 3 4 3M16 9l4 3-4 3"/></svg>
|
| 384 |
+
Gate it in your pipeline</div><pre><span class="cm"># drop-in screening step</span>
|
| 385 |
+
r = ${call}
|
| 386 |
+
<span class="kw">if</span> r.verdict == <span class="st">"HOLD"</span>:
|
| 387 |
+
pipeline.<span class="fn">block</span>(candidate, r.signals)
|
| 388 |
+
<span class="kw">elif</span> r.verdict == <span class="st">"FLAG"</span>:
|
| 389 |
+
pipeline.<span class="fn">review</span>(candidate, r.signals)
|
| 390 |
+
<span class="kw">else</span>:
|
| 391 |
+
pipeline.<span class="fn">advance</span>(candidate)</pre></div>`;
|
| 392 |
+
}
|
| 393 |
+
function provPanel(res){
|
| 394 |
+
let obs=0,pred=0,pts=0;
|
| 395 |
+
res.categories.forEach(c=>c.items.forEach(f=>{if(f.sev==="none")return;f.ev==="observed"?(obs++,pts+=f.pt||0):pred++;}));
|
| 396 |
+
return `<div class="provenance"><h4>Evidence provenance</h4>
|
| 397 |
+
<div class="prov-row"><span>Observed signals (EHR)</span><b>${obs}</b></div>
|
| 398 |
+
<div class="prov-row"><span>Predicted signals (models)</span><b>${pred}</b></div>
|
| 399 |
+
<div class="prov-row"><span>Patients supporting</span><b>${pts}</b></div>
|
| 400 |
+
<div class="prov-row"><span>Source</span><b>MIMIC notes</b></div></div>`;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
/* ---- examples ---- */
|
| 404 |
+
const NAME_EX=[["penicillin"],["metoprolol"],["warfarin","clopidogrel"],["penicillin","ceftriaxone"],["metformin","simvastatin"]];
|
| 405 |
+
const SMILES_EX="CC1=C(C=C(C=C1)NC(=O)C2=CC=C(C=C2)CN3CCN(CC3)C)NC4=NC=CC(=N4)C5=CN=CC=C5";
|
| 406 |
+
function buildChips(){
|
| 407 |
+
const c=$("chips");c.innerHTML="";
|
| 408 |
+
if(MODE==="name"){
|
| 409 |
+
NAME_EX.forEach(ex=>{const b=document.createElement("button");b.className="chip";
|
| 410 |
+
b.innerHTML=ex.length>1?`${ex[0]} <span class="op">+</span> ${ex[1]}`:ex[0];
|
| 411 |
+
b.onclick=()=>{$("q").value=ex.join(" + ");go();};c.appendChild(b);});
|
| 412 |
+
}else{
|
| 413 |
+
const b=document.createElement("button");b.className="chip smiles";
|
| 414 |
+
b.innerHTML='sample novel compound (imatinib-like)';
|
| 415 |
+
b.onclick=()=>{$("q").value=SMILES_EX;go();};c.appendChild(b);
|
| 416 |
+
}
|
| 417 |
+
}
|
| 418 |
+
function setMode(m){MODE=m;$("m-name").classList.toggle("on",m==="name");$("m-smiles").classList.toggle("on",m==="smiles");
|
| 419 |
+
$("q").value="";$("q").placeholder=m==="smiles"?"paste a SMILES string":"drug name —or— drug A + drug B";buildChips();}
|
| 420 |
+
$("m-name").onclick=()=>setMode("name");
|
| 421 |
+
$("m-smiles").onclick=()=>setMode("smiles");
|
| 422 |
+
$("run").onclick=go;
|
| 423 |
+
$("q").addEventListener("keydown",e=>{if(e.key==="Enter")go();});
|
| 424 |
+
$("backend").addEventListener("change",health);
|
| 425 |
+
|
| 426 |
+
/* init */
|
| 427 |
+
buildChips();
|
| 428 |
+
// when served over http(s) (e.g. on HuggingFace), talk to the same origin;
|
| 429 |
+
// when opened as a local file, default to localhost:8000
|
| 430 |
+
if(location.protocol==="http:"||location.protocol==="https:"){$("backend").value=location.origin;}
|
| 431 |
+
health().then(j=>{if(j){$("q").value="penicillin";go();}});
|
| 432 |
+
</script>
|
| 433 |
+
</body>
|
| 434 |
+
</html>
|