pm4py / pm4py-core

Public repository for the PM4Py (Process Mining for Python) project.
https://pm4py.fit.fraunhofer.de
GNU General Public License v3.0
722 stars 286 forks source link

CASE_ID @ token_replay #333

Closed akthammomani closed 2 years ago

akthammomani commented 2 years ago

Hi Everyone, I'm trying to add the case_id to be part of the replayed_traces output. so when using below case:concept:name, I still don't see the case_id from the output:

parameters=get_properties(log)
parameters
{'pm4py:param:activity_key': 'concept:name',
 'pm4py:param:timestamp_key': 'time:timestamp',
 'pm4py:param:group_key': 'org:group',
 'pm4py:param:transition_key': 'lifecycle:transition',
 'pm4py:param:resource_key': 'org:resource',
 'pm4py:param:case_id_key': 'case:concept:name'}

Please any help is appreciated.

Thank you

fit-alessandro-berti commented 2 years ago

Dear akthammomani,

The results of token-based replay do not include the case identifier. But, since the positions in the log and in the results of token-based replay are equivalent, it is possible to access the case ID in the log and the corresponding replay result like in the following example:

import pm4py

log = pm4py.read_xes("tests/input_data/running-example.xes") net, im, fm = pm4py.read_pnml("tests/input_data/running-example.pnml") tbr_results = pm4py.conformance_diagnostics_token_based_replay(log, net, im, fm) for i in range(len(log)): print("\ntrace", i, "with case ID",log[i].attributes["concept:name"]) print("result of the replay:", tbr_results[i])

akthammomani commented 2 years ago

Thanks @fit-alessandro-berti