Skip to content

goldigd05/CoderBash_Lucknow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧬 PharmaGuard β€” Pharmacogenomic Risk Prediction System

RIFT 2026 Hackathon | Pharmacogenomics / Explainable AI Track

Live Project demo https://coderbash-lucknow.onrender.com

CPIC Guidelines CPIC Aligned

πŸ”— Important Links

| Resource | URL | | Live Application | -:YOUR_DEPLOYED_URL_HERE | | Demo Video (LinkedIn)| -: YOUR_LINKEDIN_VIDEO_URL_HERE | | GitHub Repository** | -: https://github.com/goldigd05/CoderBash_Lucknow |

πŸ“Œ Project Title

PharmaGuard β€” AI-powered Pharmacogenomic Risk Prediction System
RIFT 2026 Hackathon | Pharmacogenomics / Explainable AI Track

🎯 Problem Statement

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

Current clinical workflows lack real-time, personalized, AI-powered decision support that can analyze a patient's VCF genetic data and instantly predict drug-specific risks with clinically actionable, CPIC-aligned recommendations.

PharmaGuard solves this by combining VCF parsing, pharmacogenomic knowledge, and Google Gemini LLM to deliver explainable, personalized drug risk predictions in seconds.

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ FRONTEND (React + Vite) β”‚ β”‚ VCF Upload β†’ Drug Input β†’ Results Dashboard β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ POST /api/analyze β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ BACKEND (FastAPI + Python) β”‚ β”‚ β”‚ β”‚ VCF Parser β†’ PGx Analyzer β†’ Risk Assessor β”‚ β”‚ ↓ β”‚ β”‚ Google Gemini LLM (XAI) β”‚ β”‚ ↓ β”‚ β”‚ JSON Output (RIFT Schema) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ§ͺ Tech Stack

Layer Technology
Backend Framework FastAPI (Python 3.11+)
LLM Integration Google Gemini 2.0 Flash (Free API)
VCF Parsing Custom pure-Python VCF v4.2 parser
PGx Knowledge Base CPIC-curated variant database
Frontend React + Vite
Deployment Render.com
API Docs FastAPI Swagger UI (/docs)

🧬 Genes & Drugs Supported

Gene Drug Clinical Risk (PM)
CYP2D6 CODEINE Ineffective β€” no morphine conversion
CYP2C19 CLOPIDOGREL Ineffective β€” no antiplatelet activation
CYP2C9 WARFARIN Toxic β€” severe bleeding risk
SLCO1B1 SIMVASTATIN Toxic β€” myopathy/rhabdomyolysis
TPMT AZATHIOPRINE Toxic (Critical) β€” fatal myelosuppression
DPYD FLUOROURACIL Toxic (Critical) β€” fatal chemo toxicity

⚑ Risk Labels

Label Color Meaning
Safe 🟒 Green Standard dosing appropriate
Adjust Dosage 🟑 Yellow Dose modification required
Toxic πŸ”΄ Red High toxicity risk at standard dose
Ineffective 🟣 Purple Drug will not work β€” use alternative
Unknown βšͺ Gray Insufficient pharmacogenomic data

πŸš€ Installation & Setup

Prerequisites

  • Python 3.11+
  • Google Gemini API key (free at aistudio.google.com)

Backend Setup step by step

bash

1. Clone the repository

git clone https://github.com/goldigd05/CoderBash_Lucknow.git cd CoderBash_Lucknow/Backend

2. Create virtual environment

python -m venv venv

Windows

venv\Scripts\activate

Mac/Linux

source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Configure environment

cp .env.example .env

Add your GEMINI_API_KEY in .env file

5. Run the server

uvicorn main:app --reload --host 0.0.0.0 --port 8000

API live at: http://localhost:8000
Swagger docs at: http://localhost:8000/docs

πŸ“‘ API Documentation

POST /api/analyze

Main analysis endpoint

Request β€” multipart/form-data:

Field Type Required Description
vcf_file File (.vcf) βœ… Patient VCF file, max 5MB
drugs String βœ… Comma-separated drug names

Example: bash curl -X POST http://localhost:8000/api/analyze
-F "vcf_file=@sample_vcf/test_patient_001.vcf"
-F "drugs=CODEINE,WARFARIN"

Response β€” Exact JSON Schema: json { "patient_id": "PATIENT_XXXXXX", "drug": "CODEINE", "timestamp": "2026-02-20T10:30:00Z", "risk_assessment": { "risk_label": "Safe", "confidence_score": 0.88, "severity": "none" }, "pharmacogenomic_profile": { "primary_gene": "CYP2D6", "diplotype": "*1/*1", "phenotype": "NM", "detected_variants": [] }, "clinical_recommendation": { "action": "Standard dosing", "dosing_guidance": "...", "cpic_recommendation": "...", "urgency": "ROUTINE", "cpic_guideline_applicable": true }, "llm_generated_explanation": { "summary": "...", "mechanism": "...", "variant_impact": "...", "clinical_context": "...", "monitoring_parameters": "...", "model_used": "gemini-2.0-flash" }, "quality_metrics": { "vcf_parsing_success": true, "variants_analyzed_for_drug": 0, "confidence_level": "HIGH" } }

GET /api/health

Returns service status.

GET /api/drugs

Returns all supported drugs and their genes.

GET /api/genes

Returns all supported pharmacogenomic genes.

GET /api/schema

Returns the full output JSON schema.

πŸ§ͺ Usage Examples

Test with Normal Patient (all Safe): bash

Upload sample_vcf/test_patient_002_normal.vcf

Drug: CODEINE,WARFARIN

Expected: Safe for all drugs

Test with Variant Patient: bash

Upload sample_vcf/test_patient_001.vcf

Drug: AZATHIOPRINE

Expected: Toxic (critical) β€” TPMT Poor Metabolizer

πŸ€– LLM Integration (Explainable AI)

PharmaGuard uses Google Gemini 2.0 Flash to generate explainable clinical explanations:

  • Every explanation cites specific rsIDs from the patient's VCF
  • 5 structured fields: summary, mechanism, variant impact, clinical context, monitoring
  • Graceful fallback if API unavailable β€” structured template used
  • Prompt engineered for clinician-grade pharmacogenomic language
  • CPIC guideline citations included in every response

πŸ“‹ CPIC Alignment

All risk assessments follow CPIC (Clinical Pharmacogenomics Implementation Consortium) guidelines:

  • Strong/Moderate recommendation levels included
  • Dosing guidance from validated CPIC tables
  • Reference URLs to cpicpgx.org in every response

πŸ‘₯ Team Members

Name Role
Dilip jagriti goldi
CoderBash tema name

πŸ“ Project Structure

Backend/ β”œβ”€β”€ main.py ← FastAPI entry point β”œβ”€β”€ requirements.txt β”œβ”€β”€ .env.example β”œβ”€β”€ sample_vcf/ β”‚ β”œβ”€β”€ test_patient_001.vcf ← Variant patient test file β”‚ └── test_patient_002_normal.vcf ← Normal patient test file └── src/ β”œβ”€β”€ parsers/ β”‚ └── vcf_parser.py ← VCF v4.2 parser β”œβ”€β”€ models/ β”‚ └── pgx_knowledge.py ← CPIC knowledge base β”œβ”€β”€ analyzers/ β”‚ β”œβ”€β”€ pgx_analyzer.py ← Diplotype/phenotype engine β”‚ └── risk_assessor.py ← Risk lookup β”œβ”€β”€ services/ β”‚ β”œβ”€β”€ llm_service.py ← Gemini API integration β”‚ └── analysis_service.py ← Orchestrator └── routes/ β”œβ”€β”€ analysis.py ← API endpoints └── health.py ← Health check

🌐 Deployment

Deployed on Render.com

Deploy your own:

  1. Push code to GitHub
  2. render.com β†’ New Web Service
  3. Build Command: pip install -r requirements.txt
  4. Start Command: uvicorn main:app --host 0.0.0.0 --port $PORT
  5. Environment Variable: GEMINI_API_KEY = your_key
  6. Deploy β†’ get live URL!

Built with ❀️ at RIFT 2026 Hackathon | May this algorithm save lives.

About

Starting of Hackthon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •