Skip to content

detector

detector ¤

LambdaDetector — the runtime object produced by register_lambda_rule.

A LambdaDetector is the lambda-rule counterpart of the 290 built-in detector classes under ts_shape.events.*. It does not subclass any of them — instead it implements the same conceptual contract:

  1. evaluate(df) returns a detector frame (the layout a built-in detector returns).
  2. to_event_log(df, ...) runs the evaluator and hands the result to the canonical :func:~ts_shape.eventlog.to_event_log dispatcher.

Because the spec is registered in :data:ts_shape.eventlog.taxonomy.REGISTRY at registration time, to_event_log finds it without any new code path.

LambdaDetector ¤

LambdaDetector(spec: RuleSpec)

Runnable form of a :class:RuleSpec.

evaluate ¤

evaluate(dataframe: DataFrame) -> pd.DataFrame

Apply the rule to dataframe and return a detector frame.

Parameters:

Name Type Description Default
dataframe DataFrame

Input DataFrame the rule's trigger expression is evaluated on.

required

Returns:

Type Description
DataFrame

Detector frame whose layout depends on the rule's shape

DataFrame

(see :func:~ts_shape.eventlog.lambda_rules.evaluator.evaluate).

to_event_log ¤

to_event_log(
    dataframe: DataFrame,
    *,
    objects: Mapping[str, object] | None = None,
    qualifiers: Mapping[str, str] | None = None
) -> EventLog

Evaluate the rule on dataframe and normalize the result to an event log.

Parameters:

Name Type Description Default
dataframe DataFrame

Input DataFrame the rule is evaluated on.

required
objects Mapping[str, object] | None

Optional OCEL object bindings, mapping an object type to a column name, callable, Series or scalar; passed through to :func:~ts_shape.eventlog.to_event_log. None uses only the auto-extracted objects.

None
qualifiers Mapping[str, str] | None

Optional mapping of object type to the relation qualifier written for that type. None leaves qualifiers empty.

None

Returns:

Type Description
EventLog

The canonical :class:~ts_shape.eventlog.model.EventLog.