🩺 Inspiration
In emergency departments, triage is the thin line between life and death. The Emergency Severity Index (ESI) is the standard 5-level protocol used to prioritize patients. While LLMs excel at processing complex unstructured complaints in native dialects, using raw AI for clinical classification introduces unacceptable risks of hallucination, omission, and under-triage.
We built SAFE-Triage Agent to bridge this gap: combining the natural language extraction power of Google Cloud's Vertex AI (Gemini 2.0 Flash) with a deterministic ESI v5 rules engine. By enforcing clinical "safety floors", rules always override the AI — guaranteeing that critical presentations (like cardiac arrests or strokes) are never under-triaged, even if the patient's description is vague or written in Egyptian Arabic dialect.
🧠 What it does
SAFE-Triage Agent processes patient clinical data (age, gender, unstructured chief complaint, and vital signs) and outputs:
- ESI Triage Level (1–5) with safety coloring (Red, Orange, Yellow, Green, Blue)
- Bilingual Clinical Reasoning (English + Egyptian Arabic)
- Safety Warnings & Floors triggered by vital signs or red-flag keywords
- Expected Resources (labs, ECG, imaging) predicted for the clinical track
- A prominent Clinician Authority Override Disclaimer
Every triage record is logged to MongoDB Atlas via the MongoDB MCP Server, with automatic fallback to native pymongo.
🛠️ How we built it
- AI Feature Extraction: Gemini 2.0 Flash via Vertex AI using Application Default Credentials — model role is strictly symptom extraction and bilingual reasoning.
- Deterministic Rules Engine: ESI v5 guidelines with vital-sign safety floors (bradycardia, hypoxia, high BP, low GCS) that automatically ceil ESI to level 1 or 2.
- Dialect NLP: Keyword matching for Egyptian Arabic idioms (e.g., "بطني بتولع فيا" — my stomach is burning).
- MCP Integration: Case persistence via MongoDB MCP Server over stdio using the official Python MCP SDK (
insert-many,find,counttools). - Graceful Fallbacks: MCP Server → pymongo driver → in-memory handler.
- Backend & Frontend: FastAPI on Cloud Run + responsive dark-mode clinical dashboard in HTML/JS.
⚠️ Challenges we ran into
Ensuring the AI can never override a deterministic rule was the core design challenge. We implemented a strict pipeline: AI Extracts → Rules Decide → Humans Confirm. The AI outputs features and structured descriptions; the final ESI assignment is always calculated deterministically by local Python rule sets.
🏆 Accomplishments we're proud of
- 0% Critical Under-Triage: Verified through our safety test suite — no ESI 1 or 2 patient was ever downgraded.
- Bilingual Arabic Dialect Handling: Robust support for Egyptian Arabic with automatic RTL alignment.
- Production-Grade MCP Integration: A live, functional use case for the Model Context Protocol in clinical automation.
🎓 What we learned
We learned the power of standardizing agentic communication through MCP. Wrapping database drivers behind standard tool schemas enables decoupled, maintainable integrations that fit perfectly within broader agent workflows.
🚀 What's next for SAFE-Triage
- Audio transcription for hands-free clinical input
- EHR schema integration via MongoDB Time-Series collections
- Multi-agent clinical consensus verification
Built With
- fastapi
- gemini
- google-cloud-run
- html
- javascript
- mcp-sdk
- mongodb-atlas
- mongodb-mcp-server
- python
- vertex-ai
Log in or sign up for Devpost to join the conversation.