AI-powered web application that predicts drug-gene interaction risks from patient VCF files with LLM-generated clinical explanations.
Brahma_pharmaGuard_New.mp4
https://pharma-guard-owc2vsdzq-karans-projects-e5b65c7e.vercel.app/
- Python 3.11+
- Node.js 18+
- OpenAI or Gemini API key (optional — fallback explanations work without one)
cd backend
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env and add your API key(s)
# Run server
uvicorn main:app --reload --port 8000Backend will be live at http://localhost:8000
API docs at http://localhost:8000/docs
cd frontend
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env: VITE_API_URL=http://localhost:8000
# Run dev server
npm run devFrontend will be live at http://localhost:3000
OPENAI_API_KEY=sk-... # OpenAI API key (GPT-4o-mini)
GEMINI_API_KEY=AIza... # Google Gemini API key (alternative)
Only one is needed. If neither is provided, rich fallback explanations are used automatically.
VITE_API_URL=http://localhost:8000
- Open
http://localhost:3000 - Upload a
.vcffile (usebackend/test_sample.vcffor testing) - Select one or more drugs to analyze
- Click Run Pharmacogenomic Analysis
- View results — risk badges, gene profiles, AI explanations, variant tables
- Download JSON report or copy to clipboard
Demo Mode: Click "Demo Mode" (no VCF needed) to test with synthetic patient data.
| Gene | Drug | Common Risk |
|---|---|---|
| CYP2D6 | CODEINE | Toxic (URM), Ineffective (PM) |
| CYP2C19 | CLOPIDOGREL | Ineffective (PM) |
| CYP2C9 | WARFARIN | Toxic (PM) |
| SLCO1B1 | SIMVASTATIN | Myopathy risk |
| TPMT | AZATHIOPRINE | Severe myelosuppression (PM) |
| DPYD | FLUOROURACIL | Life-threatening toxicity (PM) |
Analyze a VCF file for drug-gene interactions.
Form data:
file: VCF file (.vcf, max 5MB)drugs: Comma-separated drug names (e.g.,CODEINE,WARFARIN)patient_id(optional): Patient identifier
Run demo analysis with synthetic VCF data.
Form data:
drugs: Comma-separated drug names
Service health check and capabilities.
{
"patient_id": "PATIENT_001",
"drug": "CLOPIDOGREL",
"timestamp": "2024-01-01T00:00:00Z",
"risk_assessment": {
"risk_label": "Ineffective",
"confidence_score": 0.90,
"severity": "high"
},
"pharmacogenomic_profile": {
"primary_gene": "CYP2C19",
"diplotype": "*2/*2",
"phenotype": "Poor Metabolizer",
"detected_variants": []
},
"clinical_recommendation": {
"action": "...",
"notes": "..."
},
"llm_generated_explanation": {
"summary": "...",
"mechanism": "...",
"clinical_impact": "..."
},
"quality_metrics": {
"vcf_parsing_success": true
}
}You are a clinical pharmacogenomics expert AI assistant.
Patient Data:
- Drug: {drug}
- Gene: {gene}
- Variant ID: {variant_id}
- Diplotype: {diplotype}
- Phenotype: {phenotype}
- Predicted Risk: {risk_label}
- Severity: {severity}
Respond ONLY with valid JSON:
{
"summary": "2-3 sentence clinical summary",
"mechanism": "Molecular/enzymatic mechanism explanation",
"clinical_impact": "Clinical implications for healthcare providers"
}
pharmaguard/
├── backend/
│ ├── main.py # FastAPI app, routes
│ ├── parser.py # VCF parsing engine
│ ├── predictor.py # Rule-based risk prediction
│ ├── llm_service.py # OpenAI/Gemini integration
│ ├── schemas.py # Pydantic models
│ ├── requirements.txt
│ ├── test_sample.vcf # Sample test file
│ └── .env.example
└── frontend/
├── src/
│ ├── components/
│ │ ├── Header.jsx
│ │ ├── RiskBadge.jsx
│ │ ├── RiskGauge.jsx
│ │ └── DrugCard.jsx
│ ├── pages/
│ │ ├── UploadPage.jsx
│ │ └── ResultsPage.jsx
│ ├── App.jsx
│ ├── main.jsx
│ └── index.css
├── index.html
├── vite.config.js
├── tailwind.config.js
└── .env.example
PharmaGuard is a clinical decision support tool for research and educational purposes. Results must be interpreted by qualified healthcare professionals. Not for standalone clinical use.