def execute_script(): log = pm4py.read_xes("../tests/input_data/running-example.xes") dfg, sa, ea = pm4py.discover_dfg(log) tree = pm4py.discover_process_tree_inductive(log) heu_net = pm4py.discover_heuristics_net(log) net, im, fm = pm4py.discover_petri_net_alpha(log) bpmn = pm4py.convert_to_bpmn(tree) ts = ts_discovery.apply(log) x_cases, y_cases = case_statistics.get_kde_caseduration(log) gviz1 = dfg_visualizer.apply(dfg) gviz2 = tree_visualizer.apply(tree) gviz3 = hn_visualizer.apply(heu_net) gviz4 = pn_visualizer.apply(net, im, fm) gviz5 = bpmn_visualizer.apply(bpmn) gviz6 = ts_visualizer.apply(ts) gviz7 = graphs_visualizer.apply(x_cases, y_cases, variant=graphs_visualizer.Variants.CASES, parameters={graphs_visualizer.Variants.CASES.value.Parameters.FORMAT: "svg"}) print("1", len(dfg_visualizer.serialize_dot(gviz1))) print("1", len(dfg_visualizer.serialize(gviz1))) print("2", len(tree_visualizer.serialize_dot(gviz2))) print("2", len(tree_visualizer.serialize(gviz2))) print("3", len(hn_visualizer.serialize(gviz3))) print("4", len(pn_visualizer.serialize_dot(gviz4))) print("4", len(pn_visualizer.serialize(gviz4))) print("5", len(bpmn_visualizer.serialize_dot(gviz5))) print("5", len(bpmn_visualizer.serialize(gviz5))) print("6", len(ts_visualizer.serialize_dot(gviz6))) print("6", len(ts_visualizer.serialize(gviz6))) print("7", len(graphs_visualizer.serialize(gviz7)))
def test_convert_to_bpmn_from_tree(self): tree = pm4py.read_ptml("input_data/running-example.ptml") bpmn = pm4py.convert_to_bpmn(tree) self.assertTrue(isinstance(bpmn, BPMN))
""" import pandas as pd import pm4py ''' def import_csv(file_path): event_log = pandas.read_csv(file_path, sep=';') event_log = pm4py.format_dataframe(event_log, case_id='case_id', activity_key='activity', timestamp_key='timestamp') start_activities = pm4py.get_start_activities(event_log) end_activities = pm4py.get_end_activities(event_log) print("Start activities: {}\nEnd activities: {}".format(start_activities, end_activities)) ''' file_path = r'file' log = pm4py.format_dataframe(pd.read_csv(file_path, sep=';'), case_id='case_id', activity_key='activity', timestamp_key='timestamp') #log = log[log['@@index']< 40] process_tree = pm4py.discover_tree_inductive(log) bpmn_model = pm4py.convert_to_bpmn(process_tree) pm4py.view_bpmn(bpmn_model) from pm4py.algo.discovery.inductive import algorithm as inductive_miner from pm4py.visualization.process_tree import visualizer as pt_visualizer tree = inductive_miner.apply_tree(log) gviz = pt_visualizer.apply(tree) pt_visualizer.view(gviz)
log_csv_small = dataframe_utils.convert_timestamp_columns_in_df(log_csv_small) print(log_csv_small.head()) # create xes log from data frame log = log_converter.apply(log_csv_small) # inductive miner # create the process tree tree = inductive_miner.apply_tree(log) # viz tree gviz = pt_visualizer.apply(tree) pt_visualizer.view(gviz) # bpmn & viz bpmn bpmn_model = pm4py.convert_to_bpmn(tree) gviz = bpmn_visualization.apply(bpmn_model) bpmn_visualization.view(gviz) # creatig the graph from log dfg = dfg_discovery.apply(log) # viz gviz = dfg_visualization.apply(dfg, log=log, variant=dfg_visualization.Variants.FREQUENCY) dfg_visualization.view(gviz) ## bigger process model log_csv_big = pd.read_csv('./../ressource/process.csv') # log_csv_process = dataframe_utils.convert_timestamp_columns_in_df(log_csv)