Developers

The event protocol

A run is a stream of typed events. The run route emits them as Server-Sent Events so the coverage matrix can fill in live.

Seven event types

Every event in the stream is one of these. The shapes are fixed by the type contract.

run_start
The run began, with the case and policy reference.
criteria_parsed
The policy split into its criteria.
criterion_start
Work began on one criterion.
evidence
One pass reported found or not-found, with its span.
criterion_resolved
The criterion settled as proven or gap.
packet_ready
The assembled packet, with the counts and decision.
run_error
The run failed, with a message. No silent pass.

A run, as it streams

An illustrative sequence. Field values are trimmed for readability.

GET the run route (text/event-stream)
event: run_start
data: {"caseId":"aetna-0743-lumbar","service":"..."}

event: criteria_parsed
data: {"criteria":[{"id":"C1","text":"..."}, ...]}

event: evidence
data: {"id":"C1","pass":1,"found":true,"cite":{"quote":"..."}}

event: criterion_resolved
data: {"result":{"criterion":{"id":"C1"},"verdict":"proven","cite":{"quote":"..."}}}

event: packet_ready
data: {"packet":{"provenCount":8,"gapCount":1,"decision":"action-needed"}}