⚕️ Emergency Department Triage Command Center Prototype

AI-assisted triage for safer waiting-room decisions.

Triage Assist AI combines an ESI-style acuity engine, machine-learning cardiac risk prediction, deterministic red-flag safety rules, live waiting-room queue management, nurse override, audit logging, reassessment monitoring, and visible command agents.

Demo-only clinical safety note: This project is an educational prototype. A licensed clinician must confirm or override all recommendations.

What the app does

The project has evolved from a one-patient ML predictor into an emergency department workflow demo with acuity scoring, queue logic, reassessment, and clinical governance support.

🚦

ESI-style acuity engine

Recommends ESI-1 to ESI-5 using red flags, vital signs, chief complaint, resource need, pain score, and safety modifiers.

🧠

ML + expert rules

Uses XGBoost for cardiac risk while deterministic safety rules remain the source of truth for dangerous triage triggers.

🏥

Live waiting-room queue

Evaluated patients receive a patient ID and are added to a persistent queue ranked by acuity, red flags, priority, and wait timing.

👩‍⚕️

Nurse override workflow

Nurses can accept, upgrade, or downgrade recommendations. High-risk downgrades require a clinical reason.

📈

Reassessment engine

Repeat vitals are compared against the original encounter to detect improvement, deterioration, and ESI changes.

📋

Persistent audit trail

Evaluations, queue actions, overrides, reassessments, and patient timeline events are written for governance and review.

Live queue concept

The waiting-room board separates the current queue ESI from the AI recommendation and the nurse final decision, making overrides auditable instead of hidden.

Patient Wait Complaint Current Queue ESI AI Recommended ESI Nurse Final ESI Breach / Timing Safety Flag
P-001 14 min Chest pain / cardiac symptoms ESI-2 ESI-2 - Breached — room now Escalate
P-002 1 min Minor injury / laceration ESI-4 ESI-4 - OK Fast track
P-003 8 min Chest pain / cardiac symptoms ESI-5 ESI-2 ESI-5 OK Downgrade documented

Workflow

The app is designed around a realistic human-in-the-loop triage flow: AI recommends, the nurse confirms, the queue updates, and the audit trail records the decision.

1

Nurse enters triage intake

Patient demographics, vitals, chief complaint, pain score, mental status, arrival mode, risk modifiers, and expected resources.

2

ESI engine and ML predictor run

The deterministic ESI engine applies safety rules while the XGBoost model estimates cardiac risk.

3

Patient is added to the live queue

The app assigns a patient ID, stores the encounter, displays the result panel, and updates the waiting-room board.

4

Nurse confirms or overrides

Accepted and overridden decisions are persisted. High-risk downgrades require clinical documentation.

5

Reassessment detects change

Repeat vitals can downgrade or upgrade acuity while keeping the same patient ID and preserving the timeline.

Command agents

Three visible agents make the workflow feel like a hospital command center while keeping clinical safety rules deterministic.

🛡️

Safety Sentinel Agent

Reviews red flags, escalation status, abnormal vitals, and dangerous nurse downgrades.

🧭

Flow Coordinator Agent

Reviews the live queue and recommends which patients should be roomed, reassessed, escalated, or fast-tracked.

📝

Documentation Agent

Generates SBAR-style handoff support and audit-friendly clinical summaries.

Architecture and data flow

A Streamlit interface talks to a Flask backend, model artifacts, deterministic ESI logic, queue persistence, and audit logs.

%%{init: {"theme": "dark", "securityLevel": "loose", "flowchart": {"htmlLabels": true, "curve": "basis", "nodeSpacing": 70, "rankSpacing": 90}, "themeVariables": {"fontFamily": "Arial", "fontSize": "16px", "primaryColor": "#111c2e", "primaryBorderColor": "#38bdf8", "primaryTextColor": "#e6eef8", "lineColor": "#94a3b8"}}}%%
flowchart TD
    classDef default fill:#111c2e,stroke:#38bdf8,stroke-width:1.4px,color:#e6eef8,rx:14,ry:14;
    classDef storage fill:#10243a,stroke:#22c55e,stroke-width:1.4px,color:#e6eef8,rx:14,ry:14;
    classDef agent fill:#24183d,stroke:#a78bfa,stroke-width:1.4px,color:#e6eef8,rx:14,ry:14;

    A["
Nurse Intake
Form
"] --> B["
Streamlit
Frontend
"] B --> C["
Flask Backend
API
"] C --> D["
XGBoost Cardiac
Risk Model
"] C --> E["
ESI-Style
Acuity Engine
"] E --> F["
Red-Flag
Safety Rules
"] E --> G["
Likely Resource
Prediction
"] D --> H["
Generated
Output Panel
"] F --> H G --> H H --> I["
Live Waiting-Room
Queue
"] I --> J["
Queue Timing
Breach Status
"] I --> K["
Nurse
Override
"] K --> L["
Persistent
Audit Trail
"] I --> M["
Reassessment
Engine
"] M --> E M --> L H --> N["
Safety Sentinel
Agent
"] I --> O["
Flow Coordinator
Agent
"] H --> P["
Documentation
Agent
"] subgraph RAG["RAG System"] AI["
LLM RAG and
AI Committee
"] RAGDB[("
ChromaDB
Guidelines
")] end C --> AI AI -->|Semantic Search| RAGDB RAGDB -.->|Citations| AI AI --> H class L,RAGDB storage; class N,O,P,AI agent;

Run it locally

Use this section for your GitHub Pages landing page. Replace the placeholder buttons with your actual repository and live demo links.

Install and launch

git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git
cd YOUR_REPO
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
python app.py
Python Streamlit Flask XGBoost Gemini / Groq optional

Repository links

Add your real links here after pushing to GitHub.

Do not commit secrets: keep .env, API keys, local queue files, audit logs, venv/, and .git/ out of the repository.