```
███╗░░░███╗███████╗██████╗░██████╗░░█████╗░████████╗██╗░░██╗
████╗░████║██╔════╝██╔══██╗██╔══██╗██╔══██╗╚══██╔══╝██║░░██║
██╔████╔██║█████╗░░██║░░██║██████╔╝███████║░░░██║░░░███████║
██║╚██╔╝██║██╔══╝░░██║░░██║██╔═══╝░██╔══██║░░░██║░░░██╔══██║
██║░╚═╝░██║███████╗██████╔╝██║░░░░░██║░░██║░░░██║░░░██║░░██║
╚═╝░░░░░╚═╝╚══════╝╚═════╝░╚═╝░░░░░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░╚═╝
```
AI-Powered Care Navigation & Healthcare Financing for India
From first symptom to financing approval — guided by AI, every step of the way.
MedPath AI is a full-stack conversational healthcare navigation platform built for the Indian market. Describe your symptoms in plain language — the AI figures out what procedure you need, finds the right hospitals in your city, shows a personalised cost breakdown adjusted for your medical history, and walks you through applying for a Poonawalla Fincorp medical loan. All in one chat.
No phone calls. No clinic hopping. No guesswork.
- Conversational clinical intake — Gemini 2.5 Flash extracts procedure, city, urgency, and ICD-10 codes from plain language
- Emergency bypass — detected at ≥85% confidence, skips clarification entirely and surfaces hospitals immediately with a red alert banner
- Intelligent hospital ranking — scored by cost match, quality rating, NABH/JCI accreditation, wait time, and GPS distance
- Personalised cost breakdowns — comorbidity multipliers (diabetes, cardiac, kidney, etc.) applied on top of procedure base costs
- PFL loan pre-qualification — instant GREEN / YELLOW / RED eligibility decision based on CIBIL, income, FOIR, and loan multiple
- Gemini document extraction — upload your salary slip or CIBIL report and the AI fills in your financial profile automatically
- Real-time loan tracking — patient app polls loan status every 3 seconds; sees the officer's decision the moment it's made
- 5-step registration wizard — health profile, comorbidities, insurance, financials, and emergency contact
- Spectator-safe officer dashboard — completely separate Vite build for PFL officers; ships zero patient code
- AI second opinion — challenge a hospital recommendation with a follow-up question
- User profiles — persistent health history and past consultation summaries
- Real PFL API — live Poonawalla Fincorp loan disbursement integration
┌──────────────────────────────────────────────────────────┐
│ React 19 + Vite (Frontend) │
│ React Router 7 · Tailwind v4 · Zustand 5 │
└─────────────────────┬────────────────────────────────────┘
│ HTTP + REST
┌────────────┴────────────┐
│ │
┌────────▼────────┐ ┌─────────▼──────────┐
│ FastAPI 0.115 │ │ Supabase (Postgres) │
│ LangGraph │◀────▶│ + Storage Bucket │
│ Pipeline │ │ 9 tables │
└────────┬────────┘ └─────────────────────┘
│
┌────┴──────────────────────────┐
▼ ▼ ▼
INTENT PROVIDER COST + RESPONSE
Gemini Pure Python Formula Engine
2.5 Flash Hospital + Gemini
Clinical Scoring 2.5 Flash
Intake Engine
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite 8, Tailwind CSS v4, React Router 7 |
| State | Zustand 5, custom hooks (useChat, useLoan, useDocuments) |
| Backend | FastAPI 0.115, Uvicorn 0.30, Pydantic v2 |
| AI Pipeline | LangGraph 0.2.28, Gemini 2.5 Flash |
| Clinical Intake | gemini-2.5-flash (intent extraction, ICD-10 mapping) |
| Relevance + Scoring | Pure Python, Pandas, Haversine distance |
| Document Extraction | gemini-2.5-flash (PDF/image → structured JSON) |
| Database | Supabase Postgres + Supabase Storage |
- Node.js 20+
- Python 3.11+
- A Supabase project (free tier works)
- A Google Gemini API key (Gemini 2.5 Flash access required)
git clone https://github.com/yourusername/MedPathAI.git
cd MedPathAIpython -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txtCreate a .env file inside backend/:
SUPABASE_URL=https://<your-project>.supabase.co
SUPABASE_KEY=<your-supabase-anon-or-service-key>
GEMINI_API_KEY=<your-gemini-api-key>
DOCUMENT_BUCKET=medical-documents
DOCUMENT_EXTRACTION_ENABLED=falsepython ./backend/main.py # → http://localhost:8000cd medpathai
npm install
npm run dev # → http://localhost:5173 (patient app)
npm run dev:pfl # → http://localhost:5174 (PFL officer dashboard)http://localhost:5173→ Patient chat apphttp://localhost:5174→ PFL officer dashboardhttp://localhost:8000→{"status": "MedPath AI is running 🚀"}http://localhost:8000/docs→ FastAPI Swagger UI (test/api/chathere)
On first run the backend loads hospital, procedure, and city data from Supabase into memory. Seed CSVs are in backend/data/.
- Register with your health profile, comorbidities, insurance details, and financials
- Upload financial documents — salary slip, ITR, CIBIL report (Gemini extracts the data automatically)
- Open the chat and describe your symptoms or the procedure you need
- The AI asks up to 3 targeted clarifying questions — then commits to a recommendation
- Get a ranked list of hospitals in your city with personalised cost breakdowns
- Select a hospital and apply for a Poonawalla Fincorp medical loan in one click
- The AI runs an instant eligibility check and submits your application
- Track your loan status live — the PFL officer's decision appears in seconds
Every argument — sorry, every argument in the chat — runs through four stages in the LangGraph pipeline:
| Node | Model / Engine | Role |
|---|---|---|
| Intent | Gemini 2.5 Flash | Extracts procedure, city, budget, urgency, emergency flag, ICD-10 hint |
| Provider | Pure Python + Pandas | Scores hospitals by cost, quality, accreditation, wait time, GPS distance |
| Cost | Formula Engine | Personalised breakdown with comorbidity multipliers + PFL loan options |
| Response | Gemini 2.5 Flash | Generates warm, clinically-phrased summary or emergency alert |
Comorbidity multipliers: Kidney Disease +22% · Cardiac +18% · Diabetes +12% · Obesity +10% · Hypertension +8% · Asthma +6%
PFL eligibility tiers: CIBIL ≥700, income ≥₹15k/month, FOIR ≤50%, loan ≤10× income → GREEN (instant approval) · soft flags → YELLOW · hard failure → RED (alternatives suggested)
MedPathAI/
├── backend/ # FastAPI + LangGraph server
│ ├── main.py # All HTTP endpoints (15 routes)
│ ├── graph.py # LangGraph StateGraph definition
│ ├── loan_engine.py # PFL credit policy + EMI calculator
│ ├── db.py # Supabase client + all DB helpers
│ ├── data_loader.py # Hospital search + cost formulas
│ ├── nodes/
│ │ ├── intent.py # Gemini clinical intake node
│ │ ├── provider.py # Hospital scoring node (pure Python)
│ │ ├── cost.py # Cost breakdown + loan options node
│ │ └── response.py # Gemini response generation node
│ └── data/ # Seed CSVs (hospitals, procedures, cities)
│
└── medpathai/ # React 19 + Vite frontend
├── src/
│ ├── screens/
│ │ ├── Chats/ # Main chat arena + hospital cards
│ │ ├── Documents/ # Upload + Gemini extraction UI
│ │ ├── Loans/ # Loan history + status tracking
│ │ ├── Login/ # Auth screen
│ │ └── Registrations/ # 5-step onboarding wizard
│ ├── components/ # AppShell, Sidebar, EmergencyBanner
│ ├── hooks/ # useChat, useLoan, useDocuments, useGeolocation
│ ├── store/ # Zustand: chatStore, userStore, uiStore
│ └── api/ # Axios helpers per domain
└── officer/ # PFL dashboard (separate Vite build)
- Conversational AI intake via LangGraph + Gemini
- Hospital discovery + multi-factor scoring
- Personalised cost breakdowns with comorbidity multipliers
- PFL medical loan pre-qualification engine
- Gemini-powered document extraction
- Real-time loan status tracking
- PFL officer approval dashboard (separate build)
- Emergency detection + bypass flow
- 5-step registration wizard
- Admin analytics dashboard
- AI second opinion mode
- User profile settings screen
- Real Poonawalla Fincorp API integration