pm4py.objects.ocel.util.log_ocel module#

class pm4py.objects.ocel.util.log_ocel.Parameters(*values)[source]#

Bases: Enum

CASE_ID_KEY = 'pm4py:param:case_id_key'#
CASE_ATTRIBUTE_PREFIX = 'case:'#
ACTIVITY_KEY = 'pm4py:param:activity_key'#
TIMESTAMP_KEY = 'pm4py:param:timestamp_key'#
TARGET_OBJECT_TYPE = 'target_object_type'#
TARGET_OBJECT_TYPE_2 = 'target_object_type_2'#
LEFT_INDEX = 'left_index'#
RIGHT_INDEX = 'right_index'#
DIRECTION = 'direction'#
pm4py.objects.ocel.util.log_ocel.from_traditional_log(log: EventLog, parameters: Dict[Any, Any] | None = None) OCEL[source]#

Transforms an EventLog to an OCEL

Parameters:
  • log – Event log

  • parameters – Parameters of the algorithm, including: - Parameters.TARGET_OBJECT_TYPE => the name of the object type to which the cases should be mapped - Parameters.ACTIVITY_KEY => the attribute to use as activity - Parameters.TIMESTAMP_KEY => the attribute to use as timestamp - Parameters.CASE_ID_KEY => the attribute to use as case identifier

Returns:

OCEL (equivalent to the provided event log)

Return type:

ocel

pm4py.objects.ocel.util.log_ocel.from_traditional_pandas(df: DataFrame, parameters: Dict[Any, Any] | None = None) OCEL[source]#

Transforms a dataframe to an OCEL

Parameters:
  • df – Pandas dataframe

  • parameters – Parameters of the algorithm, including: - Parameters.TARGET_OBJECT_TYPE => the name of the object type to which the cases should be mapped - Parameters.ACTIVITY_KEY => the attribute to use as activity - Parameters.TIMESTAMP_KEY => the attribute to use as timestamp - Parameters.CASE_ID_KEY => the attribute to use as case identifier - Parameters.CASE_ATTRIBUTE_PREFIX => the prefix identifying the attributes at the case level

Returns:

OCEL (equivalent to the provided event log)

Return type:

ocel

pm4py.objects.ocel.util.log_ocel.from_interleavings(df1: DataFrame, df2: DataFrame, interleavings: DataFrame, parameters: Dict[Any, Any] | None = None) OCEL[source]#

Transforms a couple of dataframes, along with the interleavings between them, to an OCEL

Parameters:
  • df1 – First of the two dataframes

  • df2 – Second of the two dataframes

  • interleavings – Interleavings dataframe

  • parameters – Parameters of the algorithm, including: - Parameters.ACTIVITY_KEY => the attribute to use as activity - Parameters.TIMESTAMP_KEY => the attribute to use as timestamp - Parameters.CASE_ID_KEY => the attribute to use as case identifier - Parameters.CASE_ATTRIBUTE_PREFIX => the prefix identifying the attributes at the case level - Parameters.TARGET_OBJECT_TYPE => the name of the object type to which the cases of the first log should be mapped - Parameters.TARGET_OBJECT_TYPE_2 => the name of the object type to which the cases of the second log should be mapped - Parameters.LEFT_INDEX => the index column of the events of the first dataframe, in the interleavings dataframe - Parameters.RIGHT_INDEX => the index column of the events of the second dataframe, in the interleavings

    dataframe.

    • Parameters.DIRECTION => the direction of the interleavings (LR or RL)

Returns:

OCEL (equivalent to the provided event log)

Return type:

ocel

pm4py.objects.ocel.util.log_ocel.log_to_ocel_multiple_obj_types(log_obj: EventLog | EventStream | DataFrame, activity_column: str, timestamp_column: str, obj_types: Collection[str], obj_separator: str = ' AND ', additional_event_attributes: Collection[str] | None = None, additional_object_attributes: Dict[str, Collection[str]] | None = None) OCEL[source]#

Converts an event log to an object-centric event log with one or more than one object types.

Parameters:
  • log_obj – Log object

  • activity_column – Activity column

  • timestamp_column – Timestamp column

  • object_types – List of columns to consider as object types

  • obj_separator – Separator between different objects in the same column

  • additional_event_attributes – Additional attributes to be considered as event attributes in the OCEL

  • additional_object_attributes – Additional attributes per object type to be considered as object attributes in the OCEL (dictionary in which object types are associated to their attributes, i.e., {“order”: [“quantity”, “cost”], “invoice”: [“date”, “due date”]})

Returns:

Object-centric event log

Return type:

ocel