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

Multi filtering #354

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello am trying to apply multiple filters on my log, is there a way which i apply all at once? This i show am trying

tracefilter_log_pos = pm4py.filter_event_attribute_values(event_log, "concept:invamt", [5426,6654554], level="case", retain=True)
filtered_log = pm4py.filter_time_range(tracefilter_log_pos, "2007-07-13  00:00:00", "2008-05-03  00:00:00", mode='traces_intersecting')
pm4py.discover_dfg(filtered_log)

is it correct way what am doing. Please help me on applying filters on multiple columns at same time and pass it to function.

fit-alessandro-berti commented 1 year ago

Dear @Nanda-Incognito

No, you need to apply them one by one. If you need to apply the same set of filters to different logs, I suggest that you create a Python function accepting the event log and returning the filtered event log.

ghost commented 1 year ago

Hi @fit-alessandro-berti thanks for quick response, I dint get exactly what you suggested. what you mean creating function how would i apply filters? If you don't mind can you share me any sample reference.....

fit-alessandro-berti commented 1 year ago

The same way as above

def filter(event_log): tracefilter_log_pos = pm4py.filter_event_attribute_values(event_log, "concept:invamt", [5426,6654554], level="case", retain=True) filtered_log = pm4py.filter_time_range(tracefilter_log_pos, "2007-07-13 00:00:00", "2008-05-03 00:00:00", mode='traces_intersecting') return filtered_log

event_log = pm4py.read_xes("log.xes") filtered_event_log = filter(event_log)

ghost commented 1 year ago

thanks @fit-alessandro-berti for helping me on this.