Catches every drug-drug interaction and allergy contradiction during a pharmacist consultation in seconds — instead of an MD calling the pharmacist after the patient is home.
Pharmacists at independent and community pharmacies counsel patients on dozens of prescriptions per day. The clinically critical question — does this new drug interact dangerously with what they already take or with their allergies? — gets answered by memory and a quick Drugs.com lookup. Cross-reactivity (penicillin → amoxicillin → augmentin) is easy to miss. Critical interactions like Linezolid + Tramadol (serotonin syndrome) require the pharmacist to remember that both enzyme pathways are involved.
RxSafe ingests the voice consultation between pharmacist and patient (Whisper Large v3), extracts OTC mentions across 8 drug categories, extracts supplement mentions across 8 categories, extracts allergies from "allergic to X" patterns, cross-checks against the patient's active prescriptions, runs a curated drug-interaction map keyed by CYP enzyme pathway, surfaces critical allergy contradictions with cross-reactivity heuristics (penicillin → amoxicillin/ampicillin/augmentin), and generates a consultation brief PDF for the patient and the pharmacist's audit trail.
A pharmacist counsels Barbara, 67, on a new Warfarin prescription. She mentions she's been taking St John's Wort for mood and her grandson's leftover Tramadol when she pulled her back. RxSafe surfaces: CRITICAL: Warfarin + Aspirin via CYP2C9 (she's also taking 81 mg aspirin for cardiac); MAJOR: St John's Wort + SSRI / serotonergic agents — serotonin syndrome risk with Tramadol; CONTRAINDICATED: Linezolid + Tramadol if she's still on Linezolid from her recent UTI course. The pharmacist swaps Tramadol for Tylenol Arthritis, schedules a Warfarin level in 3 days, and prints the consultation brief.
| Metric | Manual approach | RxSafe | Improvement |
|---|---|---|---|
| Per-consultation interaction check | manual lookup per drug pair | automatic across full medication list | qualitative |
| Cross-reactivity catch rate | depends on pharmacist's memory | systematic via heuristic map | qualitative |
| Audit trail | manual notes | PDF + verbatim voice quotes per finding | manual → automated |
- Voice consultation pipeline with Whisper Large v3.
- OTC + supplement detector across 16 categories.
- Allergy extractor with cross-reactivity heuristic (penicillin family, sulfa family, etc.).
_INTERACTION_RISK_MAPkeyed by CYP enzyme pathway and active substance pair.- Severity bands — Contraindicated / Major / Moderate / Minor.
- Allergy-vs-Rx contradiction detector surfaced as the top of the brief.
- Consultation brief PDF with verbatim voice quotes per finding.
- Active prescription coverage showing what the pharmacist mentioned vs missed.
The non-obvious decision was to key the interaction map by CYP enzyme pathway, not by drug name. Drug names change (brand vs generic, regional vs international). CYP pathways are stable: CYP3A4, CYP2C9, CYP2D6 are the same in every textbook and every label. By normalising to the enzyme pathway, the same interaction rule covers Coumadin, Warfarin, Marevan, and Jantoven. New drugs get added by tagging their CYP profile, not by adding new rules.
flowchart LR
Consult[Pharmacist Voice Consultation] -->|Whisper| Transcript
Transcript --> OTC[OTC Mention Detector]
Transcript --> Supp[Supplement Detector]
Transcript --> Allerg[Allergy Extractor]
Patient[(Patient Active Rx)] --> Map
OTC --> Map[CYP Pathway Interaction Map]
Supp --> Map
Map --> Findings[(Findings + Severity)]
Allerg --> CrossReact[Cross-Reactivity Resolver]
CrossReact --> Findings
Findings --> Brief[Consultation Brief PDF]
- Backend:
fastapi,sqlalchemy+ PostgreSQL,openaiSDK via DeepInfra (Whisper),reportlab(consultation brief PDF). - Frontend:
react+vite+react-router-dom,@tanstack/react-query. - Infra: Docker Compose (api, worker, postgres, redis, frontend).
git clone https://github.com/Guembri01/rxsafe-ai.git
cd rxsafe-ai
cp .env.example .env # DEEPINFRA_API_KEY, OPENAI_API_KEY, JWT_SECRET
docker compose up -d
# API: http://localhost:8028/docs — UI: http://localhost:5028- Curated interaction map, not a live drug-database subscription. Adding a new high-risk pair is a code change today.
- English consultations only. Spanish-language counselling needs re-tuned mention regexes.
- No pharmacy-management-system integration. Active prescriptions are loaded into RxSafe directly; no bidirectional sync yet.
- Allergy cross-reactivity covers common families (penicillin, sulfa). Rare cross-reactivity (cephalosporin-penicillin partial) needs case-specific rules.
- Spanish-language consultation support.
- FDA Orange Book + RxNorm live subscription for the interaction map.
- Bidirectional integration with major pharmacy management systems.
- Pharmacist-facing mobile app for at-counter counselling.
- CYP pathway-keyed interaction map.
- Allergy cross-reactivity resolver.
- Consultation brief PDF with verbatim voice quotes.
- CYP pathway normalisation beats drug-name string matching for clinical defensibility — every textbook agrees on the pathway.
- Allergy contradictions deserve top-of-brief placement. They are the highest-severity finding and need to be the first thing the pharmacist reads.
Released under the MIT License.
Built with FastAPI, SQLAlchemy, React, Whisper via DeepInfra, and ReportLab.




