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