Skip to main content
Version: Next

ts_shape.eventlog.ocel

OCEL 2.0–shaped exporter — returns the relational tables.

ts-shape does not write OCEL JSON or SQLite itself; users feed these DataFrames to pm4py (or any other OCEL tool) directly. The column names match the OCEL 2.0 spec verbatim. pm4py additionally expects the event activity / timestamp on every E2O relation and a wide object_changes table (the new value in a column named after ocel:field); pass pm4py=True to get exactly that layout, which maps straight onto pm4py's OCEL constructor and its OCEL 2.0 JSON / XML / SQLite writers::

t = to_event_log_ocel(log, pm4py=True)
ocel = pm4py.objects.ocel.obj.OCEL(
events=t.events, objects=t.objects, relations=t.relations,
o2o=t.o2o, object_changes=t.object_changes,
)
Classes
NameDescription
OCEL2TablesThe five OCEL 2.0 relational tables produced from an :class:EventLog.
Functions
NameDescription
to_event_log_ocelReturn the OCEL 2.0 tables as an :class:OCEL2Tables bundle.

OCEL2Tables​

classsource
OCEL2Tables(
events: pd.DataFrame,
objects: pd.DataFrame,
relations: pd.DataFrame,
o2o: pd.DataFrame,
object_changes: pd.DataFrame,
) -> None

The five OCEL 2.0 relational tables produced from an :class:EventLog.

to_event_log_ocel​

functionsource
to_event_log_ocel(eventlog: EventLog, *, pm4py: bool = False) -> OCEL2Tables

Return the OCEL 2.0 tables as an :class:OCEL2Tables bundle.

The canonical schema already uses OCEL 2.0 column names, so by default this is a pass-through with defensive copy() calls to prevent caller mutation.

With pm4py=True two tables are reshaped for pm4py's OCEL object: relations gains ocel:activity and ocel:timestamp of each event, and object_changes is widened — ocel:value is replaced by one column per distinct ocel:field holding the new value on that field's rows (a field named like a base column, e.g. ocel:type, gets the column <name>_field and a :class:~ts_shape.errors.DataQualityWarning). The other tables are unchanged.

Parameters
NameTypeDescriptionDefault
eventlogEventLogThe event log to export.required
pm4pyboolReshape relations and object_changes for pm4py.False
Returns
TypeDescription
OCEL2TablesThe five tables as :class:OCEL2Tables (copies).