Built for the Great Indian AI Internship Challenge by Gnani.ai
Sovereign Indic Voice AI for Universal Healthcare, Emergency Operations & Generic Access
- 📄 Executive 1-Page Solution Pitch:
Swadhikaar_Solution_Pitch.pdf(Complies strictly with the 1-page solution pitch mandate) - 🌐 Production Live Demo: swadhikaar.vercel.app
- 🎙️ Multilingual Health & Care Sahara AI (Door 1): swadhikaar.vercel.app/patient (Supports Hinglish, Tanglish & Benglish with Gnani Prisma v3.0
indic-autoSTT and Timbre v3.0 TTS) - 🚑 Emergency EMS CAD (Door 4): swadhikaar.vercel.app/dispatch (Instant SBAR handoff, AVPU, CPR timer)
- 🏥 Clinical Ops / Doctor Copilot (Door 3): swadhikaar.vercel.app/ops
- 👩⚕️ ASHA Offline-First Field Portal (Door 2): swadhikaar.vercel.app/asha
Swadhikaar is an Indic voice-first care operations platform for proactive patient outreach, prescription literacy, hospital readiness (PM-JAY), triage, and longitudinal follow-up — powered by Gnani.ai Prisma v3.0 (STT) and Gnani.ai Timbre v3.0 (TTS).
The system combines:
- Sovereign Indic speech intelligence (Gnani Prisma & Timbre across regional languages),
- Realtime AI voice interactions over web kiosk & telephony,
- Supabase-first backend architecture,
- Ayushman Bharat Digital Mission (ABDM) FHIR R4 clinical compliance,
- Role-based clinical operations dashboards with audit trails.
Swadhikaar models a citizen's complete care lifecycle — intake → understand → access → emergency → continuity — as one voice-first, bilingual platform. Core pillars:
- Voice Walk-In Intake & Longitudinal Records: Hands-free kiosk case-taking and ABDM FHIR R4 clinical compliance.
- Prescription Understanding & Generic Access: Optical character recognition → human verification gate → daily medication routine with Jan Aushadhi generic substitution (saving up to 88%), caregiver sharing, and adherence tracking.
- PM-JAY Hospital Readiness: Location + care-need routing to empanelled hospitals (official NHA directory) with documentation checklists, voice assistance, and bed capacity intelligence.
- Acute Emergency EMS (108 CAD): Real-time distress intake with automated SBAR clinical handoffs, AVPU neurological tracking, and biological CPR pacing.
- Frontline Community Health (ASHA): Low-bandwidth offline screening portal for rural field health workers with local outbox synchronization.
Swadhikaar focuses on operational reliability for health outreach programs:
- automated follow-up and reminder calls,
- multilingual patient interactions,
- escalation-aware care workflows,
- Supabase-backed state management and reporting.
High-level flow:
- Frontend triggers workflows via Supabase Edge Functions.
- Edge Functions orchestrate call setup and domain operations.
- LiveKit worker handles live call interactions.
- Supabase stores all durable clinical and operational state.
Core principle: Supabase-first orchestration with a dedicated voice worker runtime.
swadhikaar/
|- frontend/ # Next.js application (patient/doctor/admin experiences)
|- backend/ # Voice worker runtime + data seed scripts
| `- voice_agent/ # LiveKit worker, prompts, and voice pipeline logic
|- supabase/
| |- migrations/ # Database schema migrations
| `- functions/ # Edge Functions for orchestration
`- dataset/ # Seed data CSVs
- Sovereign Speech Engine: Gnani.ai Prisma v3.0 (Indic-auto STT) & Gnani.ai Timbre v3.0 (Indic TTS)
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS, Lucide
- Data + Auth + Realtime: Supabase (Postgres with RLS & Migrations)
- Clinical Standards: ABDM FHIR R4 Bundle exports
- Voice Runtime (Telephony): LiveKit Agents (Python) with Indic failover support
- Reasoning / LLM: Google Gemini & Groq LLaMA-3.3-70B
- Node.js 20+
- Python 3.11+
- Supabase CLI
- LiveKit Cloud project
- Provider keys (as needed): Supabase, LiveKit, Google, Deepgram, Groq, optional TTS providers
Create frontend/.env.local:
NEXT_PUBLIC_SUPABASE_URL=https://<project-ref>.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=<anon-key>Create backend/.env from backend/.env.example and fill values.
Required baseline:
SUPABASE_URL=https://<project-ref>.supabase.co
SUPABASE_SERVICE_ROLE_KEY=<service-role-key>
SUPABASE_KEY=<service-role-key>
LIVEKIT_URL=wss://<livekit-project>.livekit.cloud
LIVEKIT_API_KEY=<livekit-api-key>
LIVEKIT_API_SECRET=<livekit-api-secret>
# Sovereign Indic Voice Engine (Gnani.ai)
PRIMARY_STT_PROVIDER=gnani
FAST_TTS_PROVIDER=gnani
GNANI_API_KEY=<gnani-api-key>
GNANI_STT_MODEL=prisma-v3.0
GNANI_TTS_MODEL=timbre-v3.0
# Multi-tier Speech & LLM Fallbacks
GOOGLE_API_KEY=<google-api-key>
DEEPGRAM_API_KEY=<deepgram-api-key>
GROQ_API_KEY=<groq-api-key>
MURF_API_KEY=<murf-api-key>
SARVAM_API_KEY=<sarvam-api-key>Set function runtime secrets in Supabase:
supabase secrets set SUPABASE_URL="https://<project-ref>.supabase.co"
supabase secrets set SUPABASE_SERVICE_ROLE_KEY="<service-role-key>"
supabase secrets set LIVEKIT_URL="wss://<livekit-project>.livekit.cloud"
supabase secrets set LIVEKIT_API_KEY="<livekit-api-key>"
supabase secrets set LIVEKIT_API_SECRET="<livekit-api-secret>"
supabase secrets set SIP_TRUNK_ID="<sip-trunk-id>"cd frontend
npm installpip install -r backend/requirements.txtsupabase link --project-ref <project-ref>
supabase functions deploy start-voice-call --no-verify-jwt
supabase functions deploy export-abdm --no-verify-jwt
supabase functions deploy triage-assess --no-verify-jwt
supabase functions deploy risk-predict --no-verify-jwt
supabase functions deploy incident-complete --no-verify-jwtincident-complete authenticates with a shared secret instead of a JWT, so set it
before deploying:
supabase secrets set ACUTE_INGRESS_SECRET=<random-32-bytes># Local development — hot-reloads on file change.
python backend/voice_agent/agent.py dev
# Demos and anything that places real calls — no hot reload.
python backend/voice_agent/agent.py startUse start for a demo. In dev mode the worker restarts when any file under the
project changes, and a restart mid-call drops the call — including a call the
place-due-recovery-calls cron placed a few seconds earlier.
cd frontend
npm run devstart-voice-call: room + SIP call orchestrationexport-abdm: ABDM export reference generationtriage-assess: triage severity evaluationrisk-predict: risk scoring endpointincident-complete: acute → continuity seam. A completed emergency incident upserts a patient by ABHA ID (phone fallback), writes a FHIREncounter(+Conditionwhen coded), and enrols the patient in thePost-Discharge Recoveryprotocol by scheduling Day 1/3/7/14/30 voice calls. Idempotent per incident — replaying a delivery resolves the same patient and adds no duplicate Encounter or call. Requires headerx-acute-secret.
npx supabase start # Postgres + API + Studio in Docker
npx supabase functions serve incident-complete \
--env-file supabase/functions/.env.local --no-verify-jwtsupabase/functions/.env.local holds ACUTE_INGRESS_SECRET and is gitignored.
Two checks, both runnable:
node supabase/functions/_shared/acute-seam.test.ts # pure logic: schedule math, validation
docker exec -i supabase_db_swadhikaar psql -U postgres -d postgres \
-v ON_ERROR_STOP=1 -f - < supabase/verify-seam.sql # schema contractThe SQL check exists because both real defects found in this seam lived in index
definitions, not in code, and no unit test could see them: a partial unique index cannot
arbitrate ON CONFLICT, and fhir_resources had no uniqueness at all. It also asserts
the API-role grants added in 003_api_role_grants.sql are present — without those every
table returns permission denied, because current Supabase versions no longer grant DML
on public by default and RLS policies cannot substitute for a missing GRANT.
Swadhikaar runs a sovereign Indic-first voice intelligence pipeline:
- Primary STT: Gnani.ai Prisma v3.0 (Sub-200ms Indic auto code-mixing Hinglish transcription)
- Primary TTS: Gnani.ai Timbre v3.0 (Empathetic 24kHz vernacular voice synthesis with authentic currency & numeral cadence)
- Primary LLM: Sovereign Indic Triage Engine (Evon v3.3 architecture with Gemini 2.5 Flash & Groq failover)
Resilient Multi-Tier Fallback Chain:
- STT Fallback: Deepgram Nova-3 (automatic failover if Gnani key is unset or network error occurs)
- TTS Fallback: Murf Falcon -> Sarvam Bulbul -> Rime Coda -> Google Cloud
- LLM Failover: Google Gemini 2.5 Flash -> Groq Llama 3.3 70B -> LiveKit Cloud Inference
Runtime behavior:
PRIMARY_STT_PROVIDERdefaults tognani.FAST_TTS_PROVIDERdefaults tognani.- Both STT and TTS automatically failover to secondary providers if keys are missing or provider limits are exceeded.
- Keep only one frontend lockfile source of truth (
frontend/package-lock.json). - Do not commit secrets in
.envfiles. - Use UUID patient IDs for persisted entities.
- If telephony is on Twilio trial, outbound calling can be limited to verified numbers.
401on Edge Functions: deploy with--no-verify-jwtfor non-authenticated demo paths.CORSfailures: ensure functions are redeployed after header changes.- SIP call not ringing: check trunk policy, caller ID policy, and destination country permissions.
- Groq
429: reduce context/tokens or rely on Gemini fallback. - Silent calls with TTS errors: inspect selected TTS provider logs and switch provider if codec mismatch occurs.