Skip to main content
Version: 0.0.98

ts_shape.eventlog.flat

XES-flat exporter — produces a pandas DataFrame with case:concept:name, concept:name, time:timestamp, lifecycle:transition, org:resource columns. ts-shape itself does not import pm4py; users pass this DataFrame to pm4py.format_dataframe themselves.

Functions
NameDescription
to_event_log_xesFlatten the event log into an XES-style DataFrame.

to_event_log_xes​

functionsource
to_event_log_xes(
eventlog: EventLog,
*,
case_object_type: str = "asset",
lifecycle: str = "single"
) -> pd.DataFrame

Flatten the event log into an XES-style DataFrame.

A trace is built per object of case_object_type — each event linked to that object becomes one (or two) rows in the trace.

lifecycle="single" — interval events become one row with lifecycle:transition="complete". time:timestamp is the interval-end; start_timestamp is exposed verbatim.

lifecycle="two_row" — interval events expand into a start row (using ts_shape:start_timestamp) and a complete row, paired by concept:instance.

Parameters
NameTypeDescriptionDefault
eventlogEventLogThe event log to flatten.required
case_object_typestrObject type whose objects become the traces.'asset'
lifecyclestr"single" or "two_row".'single'
Returns
TypeDescription
DataFrameDataFrame with case:concept:name, concept:name,
DataFrametime:timestamp, lifecycle:transition (and org:resource
DataFramewhen the log links operators), sorted by case and time.
DataFrameAn event log without events gives an empty frame with these
DataFramecolumns (and concept:instance for "two_row").
Raises
TypeDescription
ValueErrorWhen a log with events has no objects or no object of case_object_type, or lifecycle is unknown.