Skip to main content
Version: Next

ts_shape.eventlog.lambda_rules.evaluator

Shape-specific evaluators that turn a compiled trigger into a detector DataFrame in the same format the shape-driven adapter already consumes.

Point and summary rules pass matching rows through; interval rules coalesce contiguous True runs (per group_by) into single rows with start/end/duration; static rules emit a single summary row.

Whatever the shape, the returned frame is fed verbatim to :func:~ts_shape.eventlog.to_event_log, which then exercises the same adapter, EID generation, severity bucketing, object auto-extraction and schema validation as built-in detectors. No parallel pipeline.

Functions
NameDescription
evaluateRun spec against dataframe and return a detector frame.

evaluate​

functionsource
evaluate(spec: RuleSpec, dataframe: pd.DataFrame) -> pd.DataFrame

Run spec against dataframe and return a detector frame.

The output column conventions match what the shape adapter expects:

  • shape="point" | "summary": original rows with a systime-like timestamp column preserved (no renaming).
  • shape="interval": rows with start, end, source_uuid (if present), the group_by columns, the value column (mean over the run), the severity column (max) and sample_count. A run is half-open: it ends at the next sample after its last True row (at the last True row when no sample follows), like :func:ts_shape.signals.primitives.intervals.
  • shape="static": a single row carrying summary fields.
Parameters
NameTypeDescriptionDefault
specRuleSpecThe rule.required
dataframeDataFrameInput frame the trigger is evaluated on.required
Returns
TypeDescription
DataFrameThe detector frame; an empty (typed, for interval rules) frame when
DataFramenothing triggers.
Raises
TypeDescription
ColumnNotFoundErrorWhen the trigger names a column dataframe lacks.
ValueErrorWhen the trigger is not boolean, or an interval rule finds no time column.