pm4py.objects.ocel.util.log_ocel module#
PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
- 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