Skip to content

synamine.read

IO functions for reading event logs.

read

High-level read API -- convenient functions for loading event logs.

read_dataframe

read_dataframe(
    df: DataFrame,
    *,
    case_id: str = "case_id",
    activity: str = "activity",
    timestamp: str = "timestamp",
) -> EventLog

Create an EventLog from an existing pandas DataFrame.

PARAMETER DESCRIPTION
df

DataFrame with at least case-id, activity, and timestamp columns.

TYPE: DataFrame

case_id

Column name for case identifiers.

TYPE: str DEFAULT: "case_id"

activity

Column name for activity labels.

TYPE: str DEFAULT: "activity"

timestamp

Column name for timestamps.

TYPE: str DEFAULT: "timestamp"

RETURNS DESCRIPTION
EventLog

The event log.

read_csv

read_csv(
    path: str | Path,
    *,
    case_id: str = "case_id",
    activity: str = "activity",
    timestamp: str = "timestamp",
    **pandas_kwargs: Any,
) -> EventLog

Read a CSV file into an EventLog.

PARAMETER DESCRIPTION
path

Path to the CSV file.

TYPE: str or Path

case_id

Column name for case identifiers.

TYPE: str DEFAULT: "case_id"

activity

Column name for activity labels.

TYPE: str DEFAULT: "activity"

timestamp

Column name for timestamps.

TYPE: str DEFAULT: "timestamp"

**pandas_kwargs

Additional keyword arguments passed to pd.read_csv.

TYPE: Any DEFAULT: {}

RETURNS DESCRIPTION
EventLog

The loaded event log.

read_xes

read_xes(path: str | Path) -> EventLog

Read a XES file into an EventLog.

Parses IEEE 1849 XES XML format. Maps concept:name to activity, time:timestamp to timestamp, and trace concept:name to case_id.

PARAMETER DESCRIPTION
path

Path to the XES file.

TYPE: str or Path

RETURNS DESCRIPTION
EventLog

The loaded event log.