Drug Interaction Detection for Resource-Constrained Environments
RxRecon detects dangerous drug interactions using a Graph Neural Network (GNN). It accepts vague inputs in 12+ languages via text, voice, or images - designed for patients without access to pharmacists.
Not medical advice. This is a decision-support tool. Always consult a healthcare provider.
# Clone and start (requires Docker)
git clone https://github.com/your-org/rxrecon.git
cd rxrecon
docker-compose up -d
# Access
# Frontend: http://localhost:3000
# API Docs: http://localhost:8000/docs
One-liner for development:
make setup && make dev
Input (Text/Voice/Image)
→ Drug Identification (Multilingual + Traditional Medicine)
→ Fast-Path Detection (25+ Critical DDI pairs)
→ GNN Risk Inference (HGT with 17 node types, 20 edge types)
→ Patient Context Modulation (45+ clinical factors)
→ Safety-Lite Final Gate (Rule-based validation)
→ Layered Output (Detection + Optional Guidance)
backend/)| Component | Purpose |
|———–|———|
| app/api/ | FastAPI endpoints |
| app/gnn_max/ | GNN model (HGT++, training, inference) |
| app/services/ | Safety service, OCR, OpenAI integration |
| app/core/ | Config, security, rate limiting |
website/)Next.js 15 + React 19 clinician interface with real-time safety checks.
backend/app/gnn_max/)| File | Purpose |
|——|———|
| hgt_model.py | Heterogeneous Graph Transformer |
| config.py | 32 hazard families, 45+ patient flags |
| edge_cases.py | Multilingual matcher, traditional medicine |
| robust_inference.py | Fast-path detection, consensus layer |
| patient_context.py | Graph modulation for patient factors |
backend/data/)| Directory | Contents |
|———–|———-|
| processed/bakg.json | Bio-Action Knowledge Graph (87MB) |
| gnn_models/ | Trained model weights |
| external/ | DrugBank, RxNorm, TCMSP sources |
# Quick safety check
curl -X POST http://localhost:8000/api/v1/safety/quick-check \
-H "Content-Type: application/json" \
-d '{"drugs": ["warfarin", "aspirin"]}'
# Full safety check with patient context
curl -X POST http://localhost:8000/api/v1/safety/check \
-H "Content-Type: application/json" \
-d '{
"inputs": ["metformin", "ibuprofen"],
"patient": {"age": 72, "conditions": ["diabetes", "ckd_stage_3"]}
}'
backend/data/processed/bakg.jsoncd backend
# Full training (recommended)
python scripts/build_bakg_and_train.py --preset max --epochs 50
# Quick training (for testing)
python scripts/build_bakg_and_train.py --preset lite --epochs 10
# Skip BAKG rebuild if already exists
python scripts/build_bakg_and_train.py --skip-bakg --epochs 50
data/gnn_models/rxrecon_max_v1.pt - Full model (44MB)data/gnn_models/rxrecon_lite_v1.pt - Mobile model (8MB)python scripts/verify_gnn.py
python scripts/test_system.py
Key environment variables (.env):
# Required
DATABASE_URL=postgresql://user:pass@localhost/rxrecon
OPENAI_API_KEY=sk-...
# Optional
REDIS_URL=redis://localhost:6379
GOOGLE_VISION_API_KEY=...
RATE_LIMIT_ENABLED=true
See backend/app/core/config.py for all options.
Critical: dialysis, pregnant, cyp2d6_poor_metabolizer, hla_b5701
Important: long_qt, opioid_naive, on_anticoagulation
Additional: penicillin_allergy, heavy_alcohol_use
docker-compose up -d
# Backend
cd backend
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8000
# Frontend
cd website
npm install && npm run build && npm start
ENVIRONMENT=production in .envCORS_ORIGINSOPENAI_API_KEYResearch use only. Not for clinical deployment without proper validation.
| *RxRecon v2.0 | January 2026* |