downtime_events
Detect running-to-stopped transitions in timestamped state data, categorize stoppages into types, and compute total downtime and event details.
Instructions
[READ][risk=low] Detect running→stopped transitions and categorize stoppages.
Args:
series: Timestamped samples — {timestamp (ISO-8601), state} where state is
a string (RUNNING/IDLE/FAULT…), a bool, or a number.
category_map: Optional {state_label: category} override (else keyword
heuristics map to changeover/material/mechanical/quality/break/unknown).
min_duration_s: Ignore stoppages shorter than this (seconds).
Returns dict: {samples, event_count, total_downtime_s, by_category:{cat:
{count, downtime_s}}, events:[{start, end, duration_s, state, category}]}.
Example: downtime_events(series=[{"timestamp":"2026-06-28T08:00:00Z","state":"RUNNING"},
{"timestamp":"2026-06-28T08:05:00Z","state":"FAULT"}, ...]).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| series | Yes | ||
| category_map | No | ||
| min_duration_s | No |