Skip to main content
Version: Next

ts_shape.eventlog.taxonomy

Per-method label rules — the source of truth for ocel:activity names.

Every public DataFrame-returning method on every detector class under ts_shape.events.* must have an entry here. The coverage test tests/eventlog/test_adapter_coverage.py enforces this.

A :class:LabelRule describes:

  • template — the ocel:activity value. May contain {field} placeholders that get substituted from legacy DataFrame columns.
  • pack — one of quality, production, engineering, maintenance, supplychain, energy, correlation, development.
  • shape — how to interpret each legacy row: "point" → single-timestamp event; requires systime, "interval" → requires start and end columns, "summary" → a windowed/aggregate row; requires start and end (the event is stamped at end), "static" → no time semantics; stamped with the timestamp passed to :func:~ts_shape.eventlog.to_event_log (default: the Unix epoch).
  • produces_objects — object types the adapter auto-extracts from the legacy DataFrame's standard columns (e.g. source_uuid -> asset). Callers can always attach additional contextual object types (batch, shift, operator, ...) via the objects= argument to :func:~ts_shape.eventlog.to_event_log. Empty tuple means "no auto-extraction; objects only appear if the caller binds them".
  • object_columns — for declared object types, the detector column that carries the oid (e.g. {"serial": "identifier", "station": "station_name"} for the traceability timelines). Used when the caller does not bind that type; like source_uuid -> asset the binding is not part of the event id (the column already is). A tuple of columns links each row to the oid of every column (e.g. {"station": ("from_station", "to_station")}); an oid named twice links once.
  • eid_omit — frame columns left out of the event id: columns appended to a detector after its ids were fixed that repeat a column already in the id (the source_uuid of the MultiProcessTraceabilityEvents frames), so existing ids stay the same.
Classes
NameDescription
LabelRuleHow one detector method's output maps onto OCEL events.
Functions
NameDescription
resolveMap a deprecated class / method name to its current name.
getLook up the label rule registered for a detector method.
template_fieldsNames of the {field} placeholders in an activity template.
render_activitySubstitute {field} placeholders in rule.template from row.

LabelRule​

classsource
LabelRule(
template: str,
pack: str,
shape: str = "point",
produces_objects: tuple[str, ...] = ("asset",),
severity_field: str | None = None,
value_field: str | None = None,
drop_fields: tuple[str, ...] = (),
standard_attrs: Mapping[str, object] = dict(),
severity_thresholds: tuple[float, float] | None = None,
object_columns: Mapping[str, str | tuple[str, ...]] = dict(),
eid_omit: tuple[str, ...] = (),
) -> None

How one detector method's output maps onto OCEL events.

See the module docstring for the meaning of template, pack, shape, and produces_objects. severity_field and value_field name legacy columns read into the severity and value attributes, drop_fields lists legacy columns to discard, and standard_attrs maps standard attribute keys to a legacy column name or a literal value. object_columns maps a declared object type to the column that carries its oid (or a tuple of such columns). severity_thresholds is the (warn, critical) pair of lower bounds that buckets a numeric severity score into warn / critical (below warn is info); None uses the z-score bounds (3.0, 4.5).

resolve​

functionsource
resolve(class_name: str, method_name: str) -> tuple[str, str]

Map a deprecated class / method name to its current name.

Current names pass through unchanged, so callers can always resolve before looking up the registry.

get​

functionsource
get(class_name: str, method_name: str) -> LabelRule | None

Look up the label rule registered for a detector method.

Deprecated class and method names resolve to their current names.

Parameters
NameTypeDescriptionDefault
class_namestrName of the detector class, e.g. "LeadTimeAnalysisEvents".required
method_namestrName of the method on that class.required
Returns
TypeDescription
LabelRule | NoneThe matching LabelRule, or None if no rule is registered.

template_fields​

functionsource
template_fields(template: str) -> list[str]

Names of the {field} placeholders in an activity template.

render_activity​

functionsource
render_activity(rule: LabelRule, row: Mapping[str, object]) -> str

Substitute {field} placeholders in rule.template from row.

Missing fields and missing values (None, NaN, <NA>) render as unknown rather than raising — adapters should not crash on partial input data.

Parameters
NameTypeDescriptionDefault
ruleLabelRuleThe label rule whose template is rendered.required
rowMapping[str, object]One detector-frame row (a mapping or a pd.Series).required
Returns
TypeDescription
strThe activity name.