How tushank99/patient-triage works
TriageFlow is an ED triage assistant: a nurse submits a complaint and vitals, receives an ESI recommendation with confidence, rationale, and cited history, then accepts or overrides it; the result is audited. The backend also ingests patient documents for retrieval and supports a waiting-room queue with reassessment flags. The graph follows the documented assessment stages and includes these product branches. Several connections come from README documentation or the source index; unsampled implementations are represented only at their supported directory paths.
Main entry points: triage_pipeline.py Assessment orchestrator · models.py Clinical database · main.py HTTP application · service.py Document ingestion
Components 21
Nurse experience
- Triage interface
frontend/src/routes/index.tsx - API client
frontend/src/lib/api.ts - Triage context
frontend/src/lib/triage-context.tsx
Application API
- HTTP application
backend/app/main.py - Triage endpoint
backend/app/routers/triage.py - Visit service
backend/app/services/visit_service.py
Triage assessment
- Assessment orchestrator
backend/app/services/triage_pipeline.py - Clinical facts
backend/app/clinical/facts.py - ESI model
backend/app/ml/model.py - LLM assessment
backend/app/llm/assessor.py - Safety rules
backend/app/clinical/rules_engine.py - Decision fusion
backend/app/clinical/fusion.py - Claim grounding
backend/app/llm/grounding.py
Patient records
- History context
backend/app/services/history_store.py - Patient retrieval
backend/app/retrieval/retriever.py - Clinical database
backend/app/models.py - Document ingestion
backend/app/ingestion/service.py - Ingestion worker
backend/app/ingestion/worker.py
Queue and operations
- Queue endpoints
backend/app/routers/queue.py - Queue services
backend/app/services/demo_queue.py
Other components
- Nurse
Connections 25
- Nurse → Triage interface: enters triage
- Triage interface → Triage context: uses state
frontend/src/lib/triage-context.tsx - Triage context → API client: calls API
frontend/src/lib/triage-context.tsx - API client → HTTP application: sends requests
- HTTP application → Triage endpoint: registers route
backend/app/main.py - Triage endpoint → Visit service: handles visits
- Visit service → Assessment orchestrator: runs assessment
backend/app/services/visit_service.py - Visit service → Clinical database: persists visits
backend/app/services/visit_service.py - Assessment orchestrator → History context: loads history
backend/app/services/triage_pipeline.py - History context → Patient retrieval: retrieves passages
backend/app/services/history_store.py - History context → Clinical facts: extracts facts
backend/app/services/history_store.py - Patient retrieval → Clinical database: reads patient chunks
backend/app/retrieval/retriever.py - Assessment orchestrator → ESI model: predicts ESI
backend/app/services/triage_pipeline.py - Assessment orchestrator → LLM assessment: requests assessment
backend/app/services/triage_pipeline.py - Assessment orchestrator → Safety rules: computes safety floor
backend/app/services/triage_pipeline.py - Assessment orchestrator → Decision fusion: combines decisions
backend/app/services/triage_pipeline.py - Assessment orchestrator → Claim grounding: checks claims
backend/app/services/triage_pipeline.py - Assessment orchestrator → Clinical database: audits result
- HTTP application → Queue endpoints: registers route
backend/app/main.py - Queue endpoints → Queue services: manages queue
- Queue services → Clinical database: reads queue state
- HTTP application → Document ingestion: exposes document routes
- Document ingestion → Ingestion worker: enqueues processing
backend/app/ingestion/service.py - Ingestion worker → Document ingestion: processes jobs
backend/app/ingestion/worker.py - Document ingestion → Clinical database: stores extracted chunks
backend/app/ingestion/service.py