Skip to content

model

model ¤

The :class:EventLog dataclass — the OCEL 2.0 relational tables.

EventLog dataclass ¤

EventLog(
    events: DataFrame = schema.empty_events(),
    objects: DataFrame = schema.empty_objects(),
    relations: DataFrame = schema.empty_relations(),
    o2o: DataFrame = schema.empty_o2o(),
    object_changes: DataFrame = schema.empty_object_changes(),
)

Canonical ts-shape event log in OCEL 2.0 shape.

Five relational tables, mirroring the OCEL 2.0 standard:

  • events — one row per detected event (+ event attributes),
  • objects — the objects events refer to (ocel:oid / ocel:type),
  • relations — event-to-object (E2O) relations with qualifiers,
  • o2o — object-to-object relations with qualifiers,
  • object_changes — time-varying object attribute values.

objects / relations are empty when the source detector has no natural object association (e.g. a global cross-signal correlation statistic); o2o / object_changes are empty unless supplied. Use :attr:has_objects to check before calling :func:to_event_log_xes.

Example

Built by :func:~ts_shape.to_event_log from a detector's output:

import ts_shape df = ts_shape.make_timeseries(["temp"], n_outliers=3) out = ts_shape.OutlierDetectionEvents(df, "value_double").detect_outliers_zscore() log = ts_shape.to_event_log( ... out, detector="OutlierDetectionEvents.detect_outliers_zscore") len(log.events), log.has_objects (4, True) log.events[["ocel:activity", "ocel:timestamp"]].head(2) ocel:activity ocel:timestamp 0 quality.outlier.zscore 2025-01-01 01:34:30+00:00 1 quality.outlier.zscore 2025-01-01 03:21:00+00:00

has_objects property ¤

has_objects: bool

Whether the log contains at least one object in objects.

filter_by_pack ¤

filter_by_pack(pack: str) -> EventLog

Return a sub-log containing only the events emitted by one pack.

Objects, relations, object-to-object links, and object changes are restricted to those referenced by the kept events.

Parameters:

Name Type Description Default
pack str

Pack name to match against the ts_shape:pack column.

required

Returns:

Type Description
EventLog

A new EventLog restricted to the matching events.

filter_by_object ¤

filter_by_object(
    oid: str, type_: str | None = None
) -> EventLog

Return a sub-log containing only the events related to one object.

Events are selected through the event-to-object relations table; the other tables are restricted to the objects those events use.

Parameters:

Name Type Description Default
oid str

Object identifier (ocel:oid) to match.

required
type_ str | None

Optional object type (ocel:type) to match as well.

None

Returns:

Type Description
EventLog

A new EventLog restricted to the events related to the object.