Skip to content

aarav12e/RIFT_Pw_Hackthon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧬 PharmaGuard β€” Pharmacogenomic Risk Prediction System

AI-powered web application that analyzes patient genetic data (VCF files) and predicts personalized drug risks using CPIC guidelines + Google Gemini AI explanations.

Screen 1 Screen 2
Screen 3 Screen 4
Screen 5 Screen 6
Screen 7 Screen 8
Screen 9

πŸ”— Important Links

Link
🌐 Live Demo rift-pw-hackthon.vercel.app
πŸŽ₯ LinkedIn Video Watch Demo Video
πŸ’» GitHub Repo aarav12e/RIFT_Pw_Hackthon

πŸ₯ Problem Statement

Adverse drug reactions kill over 100,000 Americans annually. Many of these deaths are preventable through pharmacogenomic testing β€” analyzing how a patient's genetic variants affect drug metabolism.

PharmaGuard solves this by:

  • Parsing real VCF (Variant Call Format) genetic files
  • Identifying pharmacogenomic variants across 6 critical genes
  • Predicting drug-specific risks: Safe, Adjust Dosage, Toxic, or Ineffective
  • Generating clinically actionable AI explanations using Google Gemini
  • Aligning all recommendations with CPIC (Clinical Pharmacogenomics Implementation Consortium) guidelines

πŸ— Architecture Overview

User (Browser)
      β”‚
      β–Ό
React Frontend (Vercel)
      β”‚  POST /analyze
      β”‚  multipart/form-data: VCF file + drug names
      β–Ό
FastAPI Backend (Render)
      β”‚
      β”œβ”€β”€ VCF Parser
      β”‚     └── Extracts rsIDs, gene annotations, genotypes
      β”‚
      β”œβ”€β”€ CPIC Rules Engine
      β”‚     └── Maps variants β†’ star alleles β†’ phenotype (PM/IM/NM/RM/URM)
      β”‚
      β”œβ”€β”€ Risk Predictor
      β”‚     └── Phenotype + Drug β†’ Risk Label + Severity + Confidence
      β”‚
      └── Gemini AI (via HTTP)
            └── Generates clinical explanation with variant citations
      β”‚
      β–Ό
Structured JSON Response
      β”‚
      β–Ό
React UI β€” Color-coded results, confidence gauge, downloadable JSON

🧬 Supported Genes & Drugs

Drug Gene Risk if Variant Present
CODEINE CYP2D6 Respiratory depression (URM) / No effect (PM)
WARFARIN CYP2C9 Dangerous bleeding risk (PM)
CLOPIDOGREL CYP2C19 Heart attack risk β€” cannot activate prodrug (PM)
SIMVASTATIN SLCO1B1 Muscle damage / myopathy (PM)
AZATHIOPRINE TPMT Fatal bone marrow toxicity (PM)
FLUOROURACIL DPYD Life-threatening systemic toxicity (PM)

Phenotype Classification

Code Phenotype Meaning
PM Poor Metabolizer Drug builds up β€” risk of toxicity
IM Intermediate Metabolizer Reduced drug processing
NM Normal Metabolizer Standard dose is appropriate
RM Rapid Metabolizer Faster drug clearance
URM Ultrarapid Metabolizer Drug clears too fast β€” may be ineffective or toxic

βš™οΈ Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS
Backend Python, FastAPI, Uvicorn
AI/LLM Google Gemini 1.5 Flash (via direct HTTP)
VCF Parsing Custom Python parser (VCFv4.2 compliant)
CPIC Rules Hardcoded CPIC guideline mappings
Deployment Vercel (frontend) + Render (backend)
Uptime cron-job.org keep-alive ping every 10 minutes

πŸš€ Installation & Setup

Prerequisites

Backend Setup

# Clone the repo
git clone https://github.com/aarav12e/RIFT_Pw_Hackthon.git
cd RIFT_Pw_Hackthon/backend

# Install dependencies
pip install -r requirements.txt

# Create environment file
cp .env.example .env
# Edit .env and add your GEMINI_API_KEY

# Start backend server
uvicorn main:app --reload --port 8000
# Runs at http://localhost:8000

Frontend Setup

cd RIFT_Pw_Hackthon/frontend

# Install dependencies
npm install

# Create environment file
echo "VITE_API_URL=http://localhost:8000" > .env.local

# Start development server
npm run dev
# Runs at http://localhost:5173

Environment Variables

Backend .env.example:

GEMINI_API_KEY=your_gemini_api_key_here

Frontend .env.local:

VITE_API_URL=https://your-render-backend.onrender.com

πŸ“‹ API Documentation

POST /analyze

Analyzes a VCF file for pharmacogenomic drug interactions.

Request: multipart/form-data

Field Type Description
vcf_file File .vcf file, max 5MB
drugs String Comma-separated drug names e.g. CODEINE,WARFARIN

Supported drugs: CODEINE, WARFARIN, CLOPIDOGREL, SIMVASTATIN, AZATHIOPRINE, FLUOROURACIL

Single drug response:

{
  "patient_id": "PATIENT_001",
  "drug": "CODEINE",
  "timestamp": "2026-02-19T12:00:00Z",
  "risk_assessment": {
    "risk_label": "Toxic",
    "confidence_score": 0.95,
    "severity": "critical"
  },
  "pharmacogenomic_profile": {
    "primary_gene": "CYP2D6",
    "diplotype": "*4/*3",
    "phenotype": "PM",
    "detected_variants": [
      {
        "rsid": "rs3892097",
        "star_allele": "*4",
        "function_status": "no_function",
        "genotype": "1|1"
      }
    ]
  },
  "clinical_recommendation": {
    "action": "Avoid codeine. Use alternative analgesic.",
    "cpic_guideline": "CPIC Guideline for CODEINE and CYP2D6",
    "mechanism": "CYP2D6 poor metabolizers cannot convert codeine to morphine."
  },
  "llm_generated_explanation": {
    "summary": "...",
    "mechanism_explanation": "...",
    "patient_friendly": "...",
    "clinical_significance": "...",
    "monitoring_parameters": "...",
    "alternative_drugs": "..."
  },
  "quality_metrics": {
    "vcf_parsing_success": true,
    "total_variants_in_vcf": 8,
    "pharmacogenomic_variants_found": 2,
    "processing_time_seconds": 3.2
  }
}

Multiple drugs response: Returns a JSON array of the above objects, one per drug.

GET /health

{ "status": "healthy" }

GET /supported-drugs

{
  "drugs": ["CODEINE", "WARFARIN", "CLOPIDOGREL", "SIMVASTATIN", "AZATHIOPRINE", "FLUOROURACIL"],
  "genes": ["CYP2D6", "CYP2C9", "CYP2C19", "SLCO1B1", "TPMT", "DPYD"]
}

πŸ§ͺ Sample VCF Files

Located in the sample_vcf/ folder β€” use these to test all risk scenarios:

File Clinical Scenario Drug Expected Result
test1_normal_metabolizer_SAFE.vcf βœ… Normal β€” Reference Genotype CODEINE Safe Β· NM
test4_CYP2C9_PM_WARFARIN_ADJUST.vcf ⚠️ Warfarin Dose Adjustment WARFARIN Adjust Dosage · High
test7_SLCO1B1_PM_SIMVASTATIN_TOXIC.vcf πŸ”΄ Simvastatin High Risk SIMVASTATIN Adjust Dosage Β· Moderate
test6_DPYD_PM_FLUOROURACIL_CRITICAL.vcf ☠️ Fluorouracil Contraindicated FLUOROURACIL Toxic · Critical

🎯 Usage Examples

Quick Demo Flow (for judges)

  1. Open rift-pw-hackthon.vercel.app
  2. Click "☠️ Toxic β€” Fluorouracil Contraindicated" predefined scenario
  3. Click "Analyze 1 Drug β†’"
  4. See the critical red result with AI clinical explanation
  5. Click "↓ Download JSON" to verify RIFT schema compliance

Predefined Clinical Scenarios (on Dashboard)

Scenario Button Drug Expected Result
βœ… Normal β€” Reference Genotype CODEINE Safe Β· Normal Metabolizer
⚠️ Action β€” Warfarin Dose Adjustment WARFARIN Adjust Dosage Β· High Severity
πŸ”΄ Risk β€” Simvastatin High Risk SIMVASTATIN Adjust Dosage Β· Moderate
☠️ Toxic β€” Fluorouracil Contraindicated FLUOROURACIL Toxic Β· Critical Severity

⚠️ Known Limitations

  • Only 6 genes and 6 drugs supported (per RIFT specification)
  • Phenotype prediction uses simplified diplotype logic β€” does not implement full CYP2D6 Activity Score method
  • VCF parser handles standard VCFv4.2 format; exotic formats may need preprocessing
  • LLM explanations require valid Gemini API key; falls back to rule-based text if API unavailable
  • CYP2D6 copy number variations (gene duplications) not implemented
  • Not validated for clinical use β€” research and educational purposes only

πŸ‘₯ Team BugByte

Name Role
Aarav Kumar Team Lead Β· Full Stack + AI
Archana Kumari Frontend Development
Tanya Kumari Backend Development

πŸ“„ Disclaimer

PharmaGuard is built for the RIFT 2026 Hackathon. It is intended for research and educational purposes only and is not validated for clinical diagnosis or treatment decisions. Always consult a qualified healthcare professional for medical advice.


Built with ❀️ by Team BugByte for RIFT 2026 Hackathon β€” HealthTech / Pharmacogenomics Track

Hashtags: #RIFT2026 #PharmaGuard #Pharmacogenomics #AIinHealthcare

About

AI-powered pharmacogenomic risk prediction system. Analyzes patient VCF files across 6 genes (CYP2D6, CYP2C19, CYP2C9, SLCO1B1, TPMT, DPYD) to predict drug-specific risks with CPIC-aligned recommendations and Gemini AI explanations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors