compass.utilities.event_log#
Replayable event logs for one jurisdiction’s run
An EventLog appends one JSON object per line to a file as each
step happens, so a run can be followed live and replayed afterwards.
The log for the jurisdiction being processed is tracked with a context
variable, so code anywhere in the pipeline can record events with
emit_event() without passing the log around.
Events link to the workflow map (compass/data/workflow.json5): each
names the step it happened in with event_step(), and each decision
records which way it went with emit_branch(), so a replay can draw
the path a run took against every path that was possible.
Functions
|
Start of a response body as text, if it is text at all |
EventLog or None: The event log for the work in progress |
|
|
Describe a document compactly for an event |
|
Record which way a workflow decision went |
|
Record an event if an event log is active, else do nothing |
|
Event fields describing an exception and what caused it |
|
Link events inside to a node of the workflow map |
|
Attach tags (e.g. the document being checked) to events inside. |
|
Describe an HTTP exchange for the event log |
|
HTTP headers as a dict for an event, with secrets redacted |
|
ELM fetch hook: record what one document fetch produced |
|
ELM error hook: record why a URL gave no response at all |
|
ELM response hook: record each HTTP response as it arrives |
|
Summarize an API response to diagnose empty or cut answers |
|
Make log the current event log within this context |
Classes
|
Append-only JSONL event stream for one jurisdiction |
|
Usage tracker stand-in that remembers the API response metadata |