Inspiration
India has 1.2 million solo and small-clinic doctors serving 800 million patients. Every consultation generates the same fragmented work: handwritten notes, manual prescriptions, cash reconciliation, and follow-up that rarely happens. We built VaidyaAI because the problem isn't a lack of EHR software — it's that no existing tool actually reduces the clinician's workload. Most "AI medical scribes" also carry a dangerous flaw: they can hallucinate clinical details that were never spoken. We wanted AI that assists without inventing, and that fails closed on safety rather than failing open.
What it does
VaidyaAI is an AI-native clinical operating system built around seven autonomous agents that work across a single patient journey:
- AppointmentFlow — patient registration and queue triage
- ClinicalScribe — ambient voice capture → Google Speech-to-Text → Gemini 2.5 Pro → structured SOAP note, grounded against a deterministic Grounding Validator that rejects any clinical detail not actually spoken
- PrescriptionSafe — server-side allergy hard-stop; if a proposed medication conflicts with a documented allergy, the system blocks approval — it does not just show a warning
- BillingPulse — automatic invoice generation and payment reconciliation (Cash/Card/UPI/WhatsApp/Insurance/Clinic Credit)
- ReferralCoordinator — converts SOAP plan items into structured specialist/lab referrals with tracking
- RetentionRadar — identifies patients due for follow-up and drafts outreach in the patient's own language (Telugu, Hindi, English)
- InsightEngine — turns daily clinical activity into practice-level intelligence (AI Health Score, revenue trends, agent throughput)
Every consultation also exports as a FHIR R4 / ABDM-IPS compliant bundle (13 resources: Patient, Encounter, Condition, MedicationRequest, Observation, etc.), so the platform is interoperable with India's national digital health stack rather than being an isolated silo.
How we built it
Backend: Python/FastAPI on Google Cloud Run. Frontend: Next.js 14 + TypeScript + Firebase Auth. AI: Gemini 2.5 Pro (us-central1) for clinical reasoning, Gemini 2.5 Flash (asia-south1) for fast operational agents — both via Vertex AI. Speech: Google Cloud Speech-to-Text with FFmpeg audio normalization and speaker diarization. Data: PostgreSQL (Cloud SQL) + Firestore for real-time agent event streaming.
The core architectural decision was to never let the LLM be the sole authority on clinical fact. Every SOAP note passes through a deterministic Grounding Validator before a clinician ever sees it — if the model writes "dry cough" but the patient only said "cough," the descriptor is rejected. If PrescriptionSafe cannot reach its safety check, the system fails closed (blocks approval) rather than failing open (silently allowing an unsafe prescription).
Challenges we ran into
- AI hallucination in clinical documentation. Generic transcription-to-SOAP pipelines invent plausible-sounding detail. We built a Grounding Validator that compares every generated clinical fact against the actual transcript and rejects anything unsupported.
- Fail-open vs fail-closed safety. Early builds defaulted to allowing a prescription through if the safety check timed out. We rebuilt this so any AI or safety-service failure blocks the workflow instead of silently proceeding.
- Multilingual ambient audio. Real consultations mix Telugu, Hindi, and English mid-sentence. We added speech adaptation for clinical vocabulary in both languages and speaker diarization so [Doctor] and [Patient] turns are captured separately.
- Patient identity integrity. An early bug allowed a new patient registration to inherit a previous consultation's data. We rebuilt state management and added an end-to-end test verifying patient_id stays consistent across registration → appointment → consultation → prescription → invoice.
- Production infrastructure under a hackathon timeline. Firebase, Cloud Logging, and Secret Manager configuration for a live Cloud Run deployment took longer than expected; the platform is validated and demonstrated on a fully configured local production-equivalent environment.
Accomplishments that we're proud of
- 94/94 backend automated tests passing
- Real, verified Gemini 2.5 Pro execution (not mocked) — confirmed live latency, live model, live region
- A working allergy hard-stop: prescribing a penicillin-family antibiotic to a patient with a documented penicillin allergy is blocked server-side, not just flagged in the UI
- FHIR R4 / ABDM-IPS compliant clinical data export
- A real, completed, paid consultation and invoice (₹300, cash) processed entirely through the platform, start to finish
What we learned
That the hardest part of clinical AI isn't generating a plausible note — it's building the deterministic scaffolding around the model that keeps it honest. A hackathon judge (or a real clinician) doesn't need to trust the AI; they need to trust the system that constrains it.
What's next for VaidyaAI
Production Cloud Run deployment with Firebase/Firestore fully live, Razorpay UPI payment links replacing cash-only reconciliation, WhatsApp Business API for real patient-facing appointment booking, and onboarding additional clinics across Andhra Pradesh through the IMA (Indian Medical Association) network.
Built With
- cloud-run
- cloud-sql
- fastapi
- ffmpeg
- fhir
- firebase
- firebase-auth
- firestore
- gemini
- gemini-2-5-flash
- gemini-2-5-pro
- google-cloud
- google-cloud-speech-to-text
- hl7
- nextjs
- postgresql
- pydantic
- python
- razorpay
- react
- sqlalchemy
- tailwindcss
- typescript
- vertex-ai
Log in or sign up for Devpost to join the conversation.