taxonomy
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— theocel:activityvalue. May contain{field}placeholders that get substituted from legacy DataFrame columns.pack— one ofquality,production,engineering,maintenance,supplychain,energy,correlation.shape— how to interpret each legacy row:"point"→ single-timestamp event (systimeor first datetime),"interval"→ hasstart/endcolumns,"summary"→ a windowed/aggregate row (uses end column or any datetime),"static"→ no time semantics; stamped with thetimestamppassed 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 theobjects=argument to :func:~ts_shape.eventlog.to_event_log. Empty tuple means "no auto-extraction; objects only appear if the caller binds them".
LabelRule
dataclass
¤
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(),
)
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.
resolve ¤
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 ¤
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:
| Name | Type | Description | Default |
|---|---|---|---|
class_name
|
str
|
Name of the detector class, e.g. |
required |
method_name
|
str
|
Name of the method on that class. |
required |
Returns:
| Type | Description |
|---|---|
LabelRule | None
|
The matching LabelRule, or None if no rule is registered. |
template_fields ¤
template_fields(template: str) -> list[str]
Names of the {field} placeholders in an activity template.
render_activity ¤
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:
| Name | Type | Description | Default |
|---|---|---|---|
rule
|
LabelRule
|
The label rule whose |
required |
row
|
Mapping[str, object]
|
One detector-frame row (a mapping or a |
required |
Returns:
| Type | Description |
|---|---|
str
|
The activity name. |