Пример #1
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 = csv_import_adapter.import_dataframe_from_path(
            os.path.join("..", "tests", "input_data", "running-example.csv"))

        hw_values = sna_factory.apply(log, variant="handover")
        wt_values = sna_factory.apply(log, variant="working_together")
        sub_values = sna_factory.apply(log, variant="subcontracting")
Пример #2
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_factory.apply(log, variant="handover")
        wt_values = sna_factory.apply(log, variant="working_together")
        sub_values = sna_factory.apply(log, variant="subcontracting")
        ja_values = sna_factory.apply(log, variant="jointactivities")
Пример #3
0
def apply(log, variant="handover", parameters=None):
    """
    Gets the Social Network according to the specified metric and arc threshold

    Parameters
    -------------
    log
        Log
    variant
        Variant of the algorithm to use
    parameters
        Possible parameters of the algorithm (arc threshold)

    Returns
    -------------
    sna
        Social Network representation
    """
    if parameters is None:
        parameters = {}

    parameters["metric_normalization"] = True

    metric = sna_factory.apply(log, variant=variant, parameters=parameters)
    pyvis_repr = sna_vis_factory.apply(metric,
                                       variant="pyvis",
                                       parameters=parameters)

    return open(pyvis_repr).read()
Пример #4
0
def execute_script():
    log = xes_importer.apply(
        os.path.join("..", "tests", "input_data", "running-example.xes"))

    hw_values = sna_factory.apply(log, variant="handover")
    wt_values = sna_factory.apply(log, variant="working_together")
    sub_values = sna_factory.apply(log, variant="subcontracting")
    ja_values = sna_factory.apply(log, variant="jointactivities")

    gviz_sub = pn_vis_factory.apply(sub_values,
                                    variant="networkx",
                                    parameters={"format": "svg"})
    gviz_hw = pn_vis_factory.apply(hw_values, variant="pyvis")
    gviz_wt = pn_vis_factory.apply(wt_values,
                                   variant="networkx",
                                   parameters={"format": "svg"})
    gviz_ja = pn_vis_factory.apply(ja_values, variant="pyvis")

    pn_vis_factory.view(gviz_sub, variant="networkx")
    pn_vis_factory.view(gviz_hw, variant="pyvis")
    pn_vis_factory.view(gviz_wt, variant="networkx")
    pn_vis_factory.view(gviz_ja, variant="pyvis")
Пример #5
0
def work_handover():
    try:
        print(
            "Kindly enter the name of your formatted file\n"
            "Note: please include .csv file extension and make sure that input file has no blank rows or columns"
        )
        filename = str(input())
        dataframe = csv_import_adapter.import_dataframe_from_path(filename,
                                                                  sep=",")
        from pm4py.objects.conversion.log import factory as conversion_factory  # lib to convert csv to xes
        log = conversion_factory.apply(dataframe)
        from pm4py.algo.enhancement.sna import factory as sna_factory
        hw_values = sna_factory.apply(log, variant="handover")
        from pm4py.visualization.sna import factory as sna_vis_factory
        gviz_hw_py = sna_vis_factory.apply(hw_values, variant="pyvis")
        sna_vis_factory.view(gviz_hw_py, variant="pyvis")
    except FileNotFoundError:
        print("Please check your file name")