SehatSetu (सेहतसेतु) — AI Multilingual Health Triage & Emergency Navigator
SehatSetu ("Health Bridge") is a full-stack Next.js application designed to provide AI-powered, multilingual (English + Hindi) symptom triage and emergency navigation support. It is built to serve rural and underserved communities, as well as frontline community health workers (such as ASHA workers in India) who require reliable, safe, and immediate decision support when triaging patients.
1. The Problem & Solution
In underserved areas, lack of immediate medical guidance leads to two extreme outcomes:
- Critical Delay: Patients with life-threatening conditions (e.g. heart attack, stroke) delay seeking care because they do not recognize the urgency of their symptoms.
- Emergency Overload: Patients with mild, self-limiting issues seek care at tertiary hospital ERs, overloading critical healthcare infrastructures.
SehatSetu bridges this gap by acting as a safe, conservative triage aid. By accepting free-text symptom descriptions in English or Hindi, the app classifies the patient's urgency level, lists detected red-flag symptoms, details clinical reasoning, and provides direct facility navigation guidelines (e.g. Ambulance, Hospital ER, Primary Health Center, Telemedicine, or Home Care).
2. Technical System Architecture
Here is the flow of information when a user submits symptoms:
[User Input: Symptoms (EN / HI)]
│
▼
[Next.js Frontend]
│ (POST to /api/triage)
▼
┌──────────────────────────────────────────────────────────┐
│ Next.js API Triage Route │
│ │
│ 1. Run Deterministic Check (lib/redFlagRules.ts) │
│ - Matches hard-coded terms (e.g. "chest pain", │
│ "सांस की कमी") in EN & HI. │
│ │
│ 2. Call Claude 3.5 Sonnet Server-Side (lib/claude.ts) │
│ - Uses strict JSON output instructions and schema. │
│ │
│ 3. Run Response Validator (lib/triageValidator.ts) │
│ - Validates JSON fields & enum types. │
│ - Pre-programmed fail-safe fallback logic. │
│ │
│ 4. Apply Dual-Layer Safety Alignment │
│ - If deterministic checks flag a danger symptom │
│ but Claude evaluates as lower urgency: │
│ - OVERRIDE urgency to EMERGENCY │
│ - Set facility type to AMBULANCE/HOSPITAL_ER │
│ - Inject safety warnings in output. │
└──────────────────────────────────────────────────────────┘
│
▼
[Validated Response]
│
▼
[Triage Result Card]
- Colors: Red (Emergency), Orange (Urgent), etc.
- Actionable advice & Click-to-call helpline buttons.
- Prints/Saves Report (PDF).
- Persists to Local Browser History (localStorage).
3. Dual-Layer AI & Rule-Based Safety Check
A naive AI wrapper simply passes symptoms to an LLM. For clinical triage, this is highly dangerous due to hallucination risks or classification drift.
SehatSetu implements a belt-and-braces dual-layer architecture:
- Layer 1 (AI Contextual Understanding): Claude 3.5 Sonnet evaluates complex, multi-symptom descriptions, translating terms, assessing timelines, and formatting clinical reasons.
- Layer 2 (Deterministic Rule Engine): A local script (
lib/redFlagRules.ts) scans the text for specific hard-coded keywords/phrases related to medical emergencies (e.g., chest pain, facial drooping, slurred speech, active seizures) in English and Hindi. - The Safety Override: If Layer 2 fires an emergency flag, but Layer 1 (AI) returns a lower level like
ROUTINEorURGENT, the backend API immediately overrides the classification to EMERGENCY, forces ambulance recommendations, and prepends a rule warning. This ensures the app is safe-by-design.
4. Key Code Map
- types/triage.ts: TypeScript type definitions for request payloads and triage outcomes.
- lib/triagePrompt.ts: The system prompt, JSON schema configuration, and few-shot learning examples in English and Hindi.
- lib/redFlagRules.ts: The keyword scanner list and matching routines for emergency safety overrides.
- lib/triageValidator.ts: JSON extractor, field checker, and fail-safe fallback response generator.
- app/api/triage/route.ts: Server-side endpoint coordinating the workflow, handling retries, and executing safety overrides.
- components/SymptomForm.tsx: The form input supporting Web Speech API voice typing (for offline/illiterate users to speak symptoms), and quick test presets.
5. Setup & Local Execution
Prerequisites
- Node.js (v18+)
- npm (v9+)
Installation
- Clone the repository and navigate to the project directory:
bash cd sehatsetu - Install the dependencies:
bash npm install - Set up the environment variables:
- Copy
.env.local.exampleto.env.local:bash cp .env.local.example .env.local - Open
.env.localand paste your Anthropic API Key:env ANTHROPIC_API_KEY=your_actual_anthropic_api_key_here
- Copy
Run the Development Server
npm run dev
Open http://localhost:3000 on your browser.
Verify Build Compile
To test type safety and Next.js optimization compilation, run:
npm run build
6. Known Limitations
- Not a Diagnostic Tool: SehatSetu does not diagnose diseases. It is purely a triage support helper.
- Mock Facility Database: The facility database (
data/mockFacilities.ts) utilizes simulated regional primary health centers, hospitals, and national helpline numbers (like 108/104 in India) for demonstration. It should not be used as a source of truth for geographical directions without local validation.
Log in or sign up for Devpost to join the conversation.