Esempio n. 1
0
def execute_script():
    log = xes_importer.apply(
        os.path.join("..", "tests", "input_data", "running-example.xes"))

    hw_values = sna_algorithm.apply(
        log, variant=sna_algorithm.Variants.HANDOVER_LOG)
    wt_values = sna_algorithm.apply(
        log, variant=sna_algorithm.Variants.WORKING_TOGETHER_LOG)
    sub_values = sna_algorithm.apply(
        log, variant=sna_algorithm.Variants.SUBCONTRACTING_LOG)
    ja_values = sna_algorithm.apply(
        log, variant=sna_algorithm.Variants.JOINTACTIVITIES_LOG)

    gviz_sub = pn_vis.apply(
        sub_values,
        variant=pn_vis.Variants.NETWORKX,
        parameters={pn_vis.Variants.NETWORKX.value.Parameters.FORMAT: "svg"})
    gviz_hw = pn_vis.apply(hw_values, variant=pn_vis.Variants.PYVIS)
    gviz_wt = pn_vis.apply(
        wt_values,
        variant=pn_vis.Variants.NETWORKX,
        parameters={pn_vis.Variants.NETWORKX.value.Parameters.FORMAT: "svg"})
    gviz_ja = pn_vis.apply(ja_values, variant=pn_vis.Variants.PYVIS)

    pn_vis.view(gviz_sub, variant=pn_vis.Variants.NETWORKX)
    pn_vis.view(gviz_hw, variant=pn_vis.Variants.PYVIS)
    pn_vis.view(gviz_wt, variant=pn_vis.Variants.NETWORKX)
    pn_vis.view(gviz_ja, variant=pn_vis.Variants.PYVIS)
Esempio n. 2
0
    def test_pandas(self):
        # to avoid static method warnings in tests,
        # that by construction of the unittest package have to be expressed in such way
        self.dummy_variable = "dummy_value"

        log = pd.read_csv(
            os.path.join("..", "tests", "input_data", "running-example.csv"))
        log = dataframe_utils.convert_timestamp_columns_in_df(log)

        hw_values = sna_alg.apply(log,
                                  variant=sna_alg.Variants.HANDOVER_PANDAS)
        wt_values = sna_alg.apply(
            log, variant=sna_alg.Variants.WORKING_TOGETHER_PANDAS)
        sub_values = sna_alg.apply(
            log, variant=sna_alg.Variants.SUBCONTRACTING_PANDAS)
Esempio n. 3
0
    def test_1(self):
        # to avoid static method warnings in tests,
        # that by construction of the unittest package have to be expressed in such way
        self.dummy_variable = "dummy_value"

        log = xes_importer.apply(
            os.path.join("..", "tests", "input_data", "running-example.xes"))

        hw_values = sna_alg.apply(log, variant=sna_alg.Variants.HANDOVER_LOG)
        wt_values = sna_alg.apply(
            log, variant=sna_alg.Variants.WORKING_TOGETHER_LOG)
        sub_values = sna_alg.apply(log,
                                   variant=sna_alg.Variants.SUBCONTRACTING_LOG)
        ja_values = sna_alg.apply(log,
                                  variant=sna_alg.Variants.JOINTACTIVITIES_LOG)
from pm4py.objects.process_tree import pt_operator
from enum import Enum
log = xes_importer.apply(
    '/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/test.xes'
)
'''
dataframe = log_converter.apply(log, variant=log_converter.Variants.TO_DATA_FRAME)
dataframe.to_csv('/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/running-example.csv')
'''
'''
tree = inductive_miner.apply_tree(log)
gviz = pt_visualizer.apply(tree, parameters={pt_visualizer.Variants.WO_DECORATION.value.Parameters.FORMAT: "png"})
pt_visualizer.save(gviz,"/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/ptree.png")
'''

hw_values = sna.apply(log, variant=sna.Variants.HANDOVER_LOG)
gviz_hw_py = sna_visualizer.apply(hw_values,
                                  variant=sna_visualizer.Variants.PYVIS)


#sna_visualizer.view(gviz_hw_py, variant=sna_visualizer.Variants.PYVIS)
#sna_visualizer.save(gviz_hw_py,"/Users/jiao.shuai.1998.12.01outlook.com/code/07.01.2021/DES1/testfile/handover.png")
def findlabel(tree, list):
    if tree.children != []:
        for child in tree.children:
            #if child.operator != pt_operator.Operator.LOOP:
            findlabel(child, list)
    else:
        if tree.label != None:
            #print(tree.label,"tree.label")
            list.append(tree.label)
Esempio n. 5
0
    parameters={variants_filter.Parameters.POSITIVE: False})

# part of the analysis was to eliminate unwanted actions, the code below does just that.
# it is not needed to run the network however if you want to filter these activities out: uncomment it and then change
# the name in network algo sections from filtered_log1 to filtered_log2

# event_log1 = pm4py.convert_to_event_stream(filtered_log1)
# filtered_log2 = pm4py.filtering.filter_event_attribute_values(filtered_log1, 'concept:name',
#                                                               {"O_SELECTED", "O_CREATED", "O_ACCEPTED",
#                                                                "A_REGISTERED", "A_ACTIVATED",
#                                                                "O_CANCELLED", "O_DECLINED", 'A_PARTLYSUBMITTED'},
#                                                               level='event', retain=False)

# Network algorithm sections

# Handover of Work
hw_values = sna.apply(filtered_log1, variant=sna.Variants.HANDOVER_LOG)
gviz_hw_py = sna_visualizer.apply(hw_values,
                                  variant=sna_visualizer.Variants.PYVIS)
sna_visualizer.view(gviz_hw_py, variant=sna_visualizer.Variants.PYVIS)

# Subcontracting
# sub_values = sna.apply(filtered_log2, variant=sna.Variants.SUBCONTRACTING_LOG)
# gviz_sub_py = sna_visualizer.apply(sub_values, variant=sna_visualizer.Variants.PYVIS)
# sna_visualizer.view(gviz_sub_py, variant=sna_visualizer.Variants.PYVIS)

# Working Together
# wt_values = sna.apply(filtered_log2, variant=sna.Variants.WORKING_TOGETHER_LOG)
# gviz_wt_py = sna_visualizer.apply(wt_values, variant=sna_visualizer.Variants.PYVIS)
# sna_visualizer.view(gviz_wt_py, variant=sna_visualizer.Variants.PYVIS)