File size: 876 Bytes
8097001
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os

import pm4py
from pm4py.objects.conversion.process_tree import converter as pt_converter
from pm4py.algo.discovery.inductive import algorithm as inductive_miner
from pm4py.objects.log.importer.xes import importer as xes_import
from pm4py.objects.bpmn.exporter import exporter as bpmn_exporter
from examples import examples_conf
import importlib.util



def execute_script():
    log_path = os.path.join(os.path.join("..", "tests", "input_data", "running-example.xes"))
    log = xes_import.apply(log_path)
    ptree = inductive_miner.apply(log)
    bpmn = pt_converter.apply(ptree, variant=pt_converter.Variants.TO_BPMN)

    if importlib.util.find_spec("graphviz"):
        bpmn_exporter.apply(bpmn, "stru.bpmn")
        os.remove("stru.bpmn")
        pm4py.view_bpmn(bpmn, format=examples_conf.TARGET_IMG_FORMAT)


if __name__ == "__main__":
    execute_script()