示例#1
0
    def load_temp_log_if_it_is_there(self, log_name, session, parameters=None):
        """
        Load a log associated to a session if it exists in the temp logs folder

        Parameters
        --------------
        log_name
            Log name
        session
            Session ID
        parameters
            Possible parameters of the algorithm
        """
        if parameters is None:
            parameters = {}
        force_reload = parameters["force_reload"] if "force_reload" in parameters else False
        if force_reload:
            return None

        handler = None
        file_path = self.logs_correspondence[log_name]
        is_parquet = False
        extension = "xes"
        if file_path.endswith(".parquet") or file_path.endswith(".csv"):
            is_parquet = True
            extension = "parquet"
        temp_log_path = os.path.join(Configuration.temp_logs_path, str(log_name)+"_"+str(session)+"."+extension)
        if os.path.exists(temp_log_path):
            if is_parquet:
                handler = ParquetHandler(is_lazy=True)
                handler.build_from_path(temp_log_path)
            else:
                handler = XesHandler()
                handler.build_from_path(temp_log_path)
        return handler
def process_quantities_test_lazy(path):
    handler = ParquetHandler(is_lazy=True)
    handler.build_from_path(path)
    handler.get_start_activities()
    handler.get_end_activities()
    handler.get_variant_statistics()
    cases = handler.get_case_statistics()
    case_id_0 = cases[0]['caseId']
    handler.get_variant_statistics()
    handler.get_paths("concept:name")
    handler.get_attribute_values("concept:name")
    handler.get_events(case_id_0)
 def test_ru_filtering(self):
     handler = ParquetHandler(is_lazy=True)
     handler.build_from_path("files/event_logs/running-example.parquet")
     handler = handler.add_filter(
         ['timestamp_trace_intersecting', '1293703320@@@1294667760'],
         ['timestamp_trace_intersecting', '1293703320@@@1294667760'])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
     handler = handler.add_filter(
         ['timestamp_trace_containing', '1293703320@@@1294667760'],
         [['timestamp_trace_intersecting', '1293703320@@@1294667760'],
          ['timestamp_trace_containing', '1293703320@@@1294667760']])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
     handler = handler.remove_filter(
         ['timestamp_trace_containing', '1293703320@@@1294667760'],
         [['timestamp_trace_intersecting', '1293703320@@@1294667760']])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
     handler = handler.remove_filter(
         ['timestamp_trace_intersecting', '1293703320@@@1294667760'], [])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
     handler = handler.add_filter(['end_activities', ['reject request']],
                                  [['end_activities', ['reject request']]])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
     handler = handler.add_filter(
         ['attributes_pos_trace', ['concept:name', ['check ticket']]],
         [['end_activities', ['reject request']],
          ['attributes_pos_trace', ['concept:name', ['check ticket']]]])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
     handler = handler.remove_filter(
         ['attributes_pos_trace', ['concept:name', ['check ticket']]],
         [['end_activities', ['reject request']]])
     handler = handler.remove_filter(['end_activities', ['reject request']],
                                     [])
     handler.get_start_activities()
     handler.get_end_activities()
     handler.get_variant_statistics()
示例#4
0
 def test_parquets(self):
     handler = ParquetHandler()
     handler.build_from_path(os.path.join("..", "running-example.parquet"))
     handler.get_schema(variant="dfg_freq")
     handler.get_schema(variant="dfg_perf")
     handler.get_schema(variant="alpha_freq")
     handler.get_schema(variant="alpha_perf")
     handler.get_schema(variant="inductive_freq")
     handler.get_schema(variant="inductive_perf")
     handler.get_schema(variant="tree_freq")
     handler.get_schema(variant="tree_perf")
     handler.get_case_duration_svg()
     handler.get_events_per_time_svg()
     handler.get_sna(variant="handover")
     handler.get_sna(variant="working_together")
     handler.get_sna(variant="subcontracting")
     handler.get_sna(variant="jointactivities")
     handler.get_transient(86400)
示例#5
0
def basic_test(path):
    handler = ParquetHandler()
    handler.build_from_path(path)
    handler.get_schema(variant="dfg_freq")
    handler.get_schema(variant="dfg_perf")
    handler.get_schema(variant="inductive_freq")
    handler.get_schema(variant="inductive_perf")
    handler.get_schema(variant="heuristics_freq")
    handler.get_schema(variant="heuristics_perf")
    handler.get_schema(variant="tree_freq")
    handler.get_schema(variant="tree_perf")
    handler.get_case_duration_svg()
    handler.get_events_per_time_svg()
    handler.get_sna(variant="handover")
    handler.get_sna(variant="working_together")
    handler.get_sna(variant="subcontracting")
    handler.get_sna(variant="jointactivities")
    handler.get_transient(86400)
def basic_test_lazy(path):
    handler = ParquetHandler(is_lazy=True)
    handler.build_from_path(path)
    handler.get_schema(variant="dfg_freq")
    handler.get_schema(variant="dfg_perf")
    handler.get_schema(variant="inductive_freq")
    handler.get_schema(variant="inductive_perf")
    handler.get_schema(variant="heuristics_freq")
    handler.get_schema(variant="heuristics_perf")
    handler.get_schema(variant="tree_freq")
    handler.get_schema(variant="tree_perf")
    handler.get_case_duration_svg()
    handler.get_events_per_time_svg()
    handler.get_sna(variant="handover")
    handler.get_sna(variant="working_together")
    handler.get_sna(variant="subcontracting")
    handler.get_sna(variant="jointactivities")
    handler.get_transient(86400)
    handler.get_events_for_dotted(
        ["time:timestamp", "@@case_index", "concept:name"])
    def load_log_on_request(self, log_name):
        """
        Loads an event log on request

        Parameters
        ------------
        log_path
            Log name
        """
        handler = None
        file_path = self.logs_correspondence[log_name]

        if file_path.endswith(".parquet"):
            handler = ParquetHandler(is_lazy=True)
            handler.build_from_path(file_path)
        elif file_path.endswith(".csv"):
            handler = ParquetHandler(is_lazy=True)
            handler.build_from_csv(file_path)
        elif file_path.endswith(".xes") or file_path.endswith(".xes.gz"):
            handler = XesHandler()
            handler.build_from_path(file_path)
        elif file_path.endswith("xml"):
            handler = XmlHandler()
            handler.build_from_path(file_path)
        return handler