Live Demo: [https://pharma-guard-xi.vercel.app/)
LinkedIn Demo Video: [https://www.linkedin.com/posts/kshitij-kj-jain-422025342_rift2026-pharmaguard-pharmacogenomics-ugcPost-7430411725461696513-1OtM?utm_source=share&utm_medium=member_desktop&rcm=ACoAAFXJ5hoBUz7esGLvvjsw-U0_Mhuo9yf44Oo)
GitHub Repository: [https://github.com/Harsh99830/PharmGuard)
Adverse drug reactions cause over 100,000 deaths annually in the United States. Many of these deaths are preventable through pharmacogenomic testing — analyzing how genetic variants affect drug metabolism.
PharmaGuard is an AI-powered web application that analyzes patient genetic data (VCF files) and drug names to predict personalized pharmacogenomic risks and provide clinically actionable recommendations with LLM-generated explanations.
The system consists of a React frontend communicating with a FastAPI backend, which processes VCF files and integrates with OpenAI for clinical explanations. The application follows CPIC guidelines for pharmacogenomic recommendations.
- React 19.2.0 - Modern React framework with hooks
- Vite 7.3.1 - Fast build tool and development server
- TailwindCSS 4.2.0 - Utility-first CSS framework
- React Router DOM 7.13.0 - Client-side routing
- Framer Motion 12.34.2 - Animation library
- React Icons 5.5.0 - Icon library
- FastAPI - Modern web framework for building APIs
- Uvicorn - ASGI server for FastAPI
- cyvcf2 - Efficient VCF file parsing
- OpenAI - LLM integration for clinical explanations
- Python-dotenv - Environment variable management
- Supported Format: Variant Call Format v4.2
- File Size Limit: Up to 5 MB
- Genes Analyzed: CYP2D6, CYP2C19, CYP2C9, SLCO1B1, TPMT, DPYD
- Validation: Comprehensive VCF structure validation
- Supported Drugs: CODEINE, WARFARIN, CLOPIDOGREL, SIMVASTATIN, AZATHIOPRINE, FLUOROURACIL
- Risk Categories: Safe, Adjust Dosage, Toxic, Ineffective, Unknown
- Confidence Scoring: 0.0-1.0 scale with severity levels
- CPIC Guidelines Integration: Evidence-based dosing recommendations
- LLM-Generated Explanations: Clinical insights with variant citations
- Phenotype Prediction: PM, IM, NM, RM, URM classification
- Diplotype Analysis: Star allele identification
The application generates structured JSON output matching the exact required schema:
{
"patient_id": "PATIENT_XXX",
"drug": "DRUG_NAME",
"timestamp": "ISO8601_timestamp",
"risk_assessment": {
"risk_label": "Safe|Adjust Dosage|Toxic|Ineffective|Unknown",
"confidence_score": 0.0,
"severity": "none|low|moderate|high|critical"
},
"pharmacogenomic_profile": {
"primary_gene": "GENE_SYMBOL",
"diplotype": "*X/*Y",
"phenotype": "PM|IM|NM|RM|URM|Unknown",
"detected_variants": [
{
"rsid": "rsXXXX",
"gene": "GENE_SYMBOL",
"star_allele": "*X",
"clinical_significance": "Pathogenic|Likely pathogenic|Benign",
"frequency": "0.XX"
}
]
},
"clinical_recommendation": {
"action": "Continue|Adjust dose|Avoid|Consider alternative",
"dosage_adjustment": "Specific instructions",
"monitoring_requirements": "Required monitoring",
"alternative_drugs": ["Alternative options"]
},
"llm_generated_explanation": {
"summary": "Clinical summary",
"mechanism": "Biological mechanism explanation",
"evidence_level": "Level of evidence",
"citations": ["Relevant citations"]
},
"quality_metrics": {
"vcf_parsing_success": true,
"variant_coverage": 0.0,
"annotation_completeness": 0.0
}
}- Python 3.8+
- Node.js 18+
- npm or yarn
-
Navigate to backend directory:
cd backend -
Create virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env with your OpenAI API key -
Start the backend server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env # Edit .env with your backend URL -
Start the development server:
npm run dev
# Build and run with Docker Compose
docker-compose up --build-
Install Vercel CLI:
npm i -g vercel
-
Deploy from frontend directory:
cd frontend vercel --prod
- Render: Connect GitHub repository for automatic deployment
- Heroku: Use Procfile and requirements.txt
- AWS/GCP/Azure: Container-based deployment
Analyzes VCF file and drug input for pharmacogenomic risk assessment.
Request:
- Content-Type:
multipart/form-data - Body:
file: VCF file (max 5MB)drugs: Comma-separated drug names
Response: JSON object matching the schema above
Health check endpoint.
Response:
{
"status": "healthy",
"timestamp": "ISO8601_timestamp"
}Returns list of supported drugs.
Response:
{
"drugs": ["CODEINE", "WARFARIN", "CLOPIDOGREL", "SIMVASTATIN", "AZATHIOPRINE", "FLUOROURACIL"]
}curl -X POST "http://localhost:8000/api/analyze" \
-F "file=@sample.vcf" \
-F "drugs=CODEINE"curl -X POST "http://localhost:8000/api/analyze" \
-F "file=@sample.vcf" \
-F "drugs=CODEINE,WARFARIN,CLOPIDOGREL"Sample VCF files are provided in the /test-data directory:
sample_patient_1.vcf- Normal metabolizer profilesample_patient_2.vcf- Poor metabolizer profilesample_patient_3.vcf- Ultra-rapid metabolizer profile
- Drag-and-drop or file picker functionality
- Real-time VCF file validation
- File size indicator and progress tracking
- Error handling for invalid formats
- Multi-select dropdown with search functionality
- Comma-separated text input support
- Drug information tooltips
- Input validation and suggestions
- Color-coded risk assessment (Green/Yellow/Red)
- Expandable sections for detailed analysis
- Interactive variant visualization
- Downloadable JSON reports
- Copy-to-clipboard functionality
- User-friendly error messages
- Graceful degradation for missing data
- Input validation feedback
- Retry mechanisms for failed uploads
The system integrates with Clinical Pharmacogenetics Implementation Consortium (CPIC) guidelines:
- Gene-Drug Pairs: Evidence-based recommendations
- Dosing Tables: Specific dosage adjustments
- Phenotype Translation: Star allele to phenotype mapping
- Alternative Therapies: Recommended alternatives when needed
# Backend tests
cd backend
python -m pytest tests/
# Frontend tests
cd frontend
npm test- VCF parsing validation
- Risk assessment accuracy
- JSON schema compliance
- UI component testing
- Integration testing
- HIPAA Compliance: No PHI storage in logs
- Data Encryption: HTTPS/TLS encryption
- File Validation: Malicious file detection
- API Rate Limiting: Prevent abuse
- Input Sanitization: XSS protection
- VCF Processing: < 2 seconds for 5MB files
- API Response Time: < 500ms average
- UI Load Time: < 3 seconds
- Memory Usage: < 512MB per request
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@pharmaguard.app
This project is licensed under the MIT License - see the LICENSE file for details.
- Lead Developer: Your Name
- Backend Engineer: Team Member
- Frontend Engineer: Team Member
- Clinical Consultant: Team Member
- CPIC Consortium for pharmacogenomic guidelines
- PharmGKB for drug-gene interaction data
- OpenAI for LLM capabilities
- RIFT 2026 for the opportunity to build this solution
Disclaimer: This tool is for educational and research purposes only. Clinical decisions should not be based solely on this application. Always consult with qualified healthcare professionals and refer to official CPIC guidelines for clinical use.
#RIFT2026 #PharmaGuard #Pharmacogenomics #AIinHealthcare