linpershey/process_mining
0
1import pm4py2import os3import unittest4 5 6class OcelDiscoveryTest(unittest.TestCase):7 def test_discovery_ocfg_f1(self):8 target_path = os.path.join("test_output_data", "model.svg")9 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))10 ocdfg = pm4py.discover_ocdfg(ocel)11 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="frequency", act_metric="events", edge_metric="ev_couples", act_threshold=2, edge_threshold=1)12 os.remove(target_path)13 14 def test_discovery_ocfg_f2(self):15 target_path = os.path.join("test_output_data", "model.svg")16 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))17 ocdfg = pm4py.discover_ocdfg(ocel)18 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="frequency", act_metric="unique_objects", edge_metric="ev_couples", act_threshold=2, edge_threshold=1)19 os.remove(target_path)20 21 def test_discovery_ocfg_f3(self):22 target_path = os.path.join("test_output_data", "model.svg")23 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))24 ocdfg = pm4py.discover_ocdfg(ocel)25 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="frequency", act_metric="total_objects", edge_metric="ev_couples", act_threshold=2, edge_threshold=1)26 os.remove(target_path)27 28 29 def test_discovery_ocfg_f4(self):30 target_path = os.path.join("test_output_data", "model.svg")31 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))32 ocdfg = pm4py.discover_ocdfg(ocel)33 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="frequency", act_metric="unique_objects", edge_metric="unique_objects", act_threshold=2, edge_threshold=1)34 os.remove(target_path)35 36 37 def test_discovery_ocfg_f5(self):38 target_path = os.path.join("test_output_data", "model.svg")39 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))40 ocdfg = pm4py.discover_ocdfg(ocel)41 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="frequency", act_metric="unique_objects", edge_metric="total_objects", act_threshold=2, edge_threshold=1)42 os.remove(target_path)43 44 45 def test_discovery_ocfg_p1(self):46 target_path = os.path.join("test_output_data", "model.svg")47 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))48 ocdfg = pm4py.discover_ocdfg(ocel)49 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="performance", act_metric="events", edge_metric="ev_couples", act_threshold=2, edge_threshold=1)50 os.remove(target_path)51 52 def test_discovery_ocfg_p2(self):53 target_path = os.path.join("test_output_data", "model.svg")54 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))55 ocdfg = pm4py.discover_ocdfg(ocel)56 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="performance", act_metric="unique_objects", edge_metric="ev_couples", act_threshold=2, edge_threshold=1)57 os.remove(target_path)58 59 def test_discovery_ocfg_p3(self):60 target_path = os.path.join("test_output_data", "model.svg")61 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))62 ocdfg = pm4py.discover_ocdfg(ocel)63 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="performance", act_metric="total_objects", edge_metric="ev_couples", act_threshold=2, edge_threshold=1)64 os.remove(target_path)65 66 67 def test_discovery_ocfg_p4(self):68 target_path = os.path.join("test_output_data", "model.svg")69 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))70 ocdfg = pm4py.discover_ocdfg(ocel)71 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="performance", act_metric="unique_objects", edge_metric="total_objects", act_threshold=2, edge_threshold=1)72 os.remove(target_path)73 74 75 def test_discovery_ocfg_p5(self):76 target_path = os.path.join("test_output_data", "model.svg")77 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))78 ocdfg = pm4py.discover_ocdfg(ocel, business_hours=True)79 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="performance", act_metric="unique_objects", edge_metric="total_objects", act_threshold=2, edge_threshold=1)80 os.remove(target_path)81 82 83 def test_discovery_ocfg_p6(self):84 target_path = os.path.join("test_output_data", "model.svg")85 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))86 ocdfg = pm4py.discover_ocdfg(ocel, business_hours=True)87 pm4py.save_vis_ocdfg(ocdfg, target_path, annotation="performance", act_metric="unique_objects", edge_metric="total_objects", act_threshold=2, edge_threshold=1, performance_aggregation="median")88 os.remove(target_path)89 90 def test_discovery_ocpn_im(self):91 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))92 ocpn = pm4py.discover_oc_petri_net(ocel, inductive_miner_variant="im")93 94 def test_discovery_ocpn_imd(self):95 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))96 ocpn = pm4py.discover_oc_petri_net(ocel, inductive_miner_variant="imd")97 98 def test_discovery_saw_nets_ocel(self):99 from pm4py.algo.discovery.ocel.saw_nets import algorithm as saw_nets_disc100 ocel = pm4py.read_ocel(os.path.join("input_data", "ocel", "example_log.jsonocel"))101 saw_nets_disc.apply(ocel)102 103 104if __name__ == "__main__":105 unittest.main()106 