Triage
AI-powered medical triage engine — collects symptoms via a conversational session and produces care pathway recommendations.
Overview
The Triage service guides members through a structured symptom assessment and produces a recommended care pathway. Sessions proceed through a dialogue where the engine asks clarifying questions, collects answers, and either follows a deterministic DDx (differential diagnosis) decision tree or routes to an LLM for open-ended reasoning when the tree cannot resolve the case.
A triage session has a simple lifecycle: it opens when a member submits a chief complaint (along with a verified consent timestamp), progresses through one or more conversational turns, and completes when the engine produces a recommendation. Sessions can also be abandoned. Each turn is recorded immutably for audit and care continuity purposes.
The recommendation field on a completed session is a JSONB object describing the outcome — care pathway (self-care, GP appointment, urgent care, ED), severity level, and optionally a specialist referral.
Responsibilities
- Accept session creation requests with a chief complaint and consent verification
- Drive the triage dialogue via a hybrid DDx tree + LLM engine
- Record all turns (questions and answers) immutably
- Produce a structured recommendation on session completion
- Allow sessions to be abandoned without a recommendation
- Expose session state for Care service integration
Database
Schema: triage
| Table | Purpose |
|---|---|
sessions | Triage session root with status, severity, consent timestamp, and final recommendation (JSONB) |
turns | Immutable ordered turns (system question / member answer) per session |
API Routes
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /sessions | JWT | Start a new triage session with a chief complaint |
GET | /sessions/{locator} | JWT | Get session state and all turns |
POST | /sessions/{locator}/respond | JWT | Submit a member answer, receive next question |
GET | /sessions/{locator}/recommendation | JWT | Get the final recommendation for a completed session |
PATCH | /sessions/{locator}/abandon | JWT | Abandon an in-progress session |
Events
Publishes
The Triage service does not publish Kafka events.
Consumes
The Triage service does not consume Kafka events.
Dependencies
The Triage service has no runtime service dependencies. It calls the configured LLM endpoint (via OpenRouter or a compatible API) for open-ended reasoning turns.
Key Design Decisions
Hybrid tree + LLM engine: The DDx decision tree (TreePath) handles well-defined symptom presentations with low latency and deterministic outcomes. When the tree cannot resolve a node (e.g., ambiguous or atypical presentations), the engine falls back to the LLM. This balances consistency for common cases with flexibility for edge cases.
Consent timestamp as first-class field: The consent_verified_at timestamp is required at session creation and stored immutably. This ensures there is an auditable record that the member explicitly consented to AI-assisted triage before any medical assessment began.