Skip to main content
Version: 0.0.98

ts_shape.eventlog.lambda_rules.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.

Classes
NameDescription
LambdaDetectorRunnable form of a :class:RuleSpec.

LambdaDetector​

classsource
LambdaDetector(spec: RuleSpec) -> None

Runnable form of a :class:RuleSpec.

Functions
NameDescription
evaluateApply the rule to dataframe and return a detector frame.
to_event_logEvaluate the rule on dataframe and normalize the result to an event log.
Parameters
NameTypeDescriptionDefault
specRuleSpecRule spec whose trigger expression the detector evaluates.required

evaluate​

methodsource
evaluate(dataframe: pd.DataFrame) -> pd.DataFrame

Apply the rule to dataframe and return a detector frame.

Parameters
NameTypeDescriptionDefault
dataframeDataFrameInput DataFrame the rule's trigger expression is evaluated on.required
Returns
TypeDescription
DataFrameDetector frame whose layout depends on the rule's shape
DataFrame(see :func:~ts_shape.eventlog.lambda_rules.evaluator.evaluate).

to_event_log​

methodsource
to_event_log(
dataframe: pd.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
NameTypeDescriptionDefault
dataframeDataFrameInput DataFrame the rule is evaluated on.required
objectsMapping[str, object] | NoneOptional 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
qualifiersMapping[str, str] | NoneOptional mapping of object type to the relation qualifier written for that type. None leaves qualifiers empty.None

A rule that is not registered (built directly from a :class:RuleSpec rather than with :func:register_lambda_rule) is labelled from its own spec for this call; the global taxonomy is left as it is.

Returns
TypeDescription
EventLogThe canonical :class:~ts_shape.eventlog.model.EventLog.