Ejemplo n.º 1
0
 def calculate_dfg(self, parameters=None):
     if parameters is None:
         parameters = {}
     list_logs = self.get_list_logs()
     for key in self.init_parameters:
         if key not in parameters:
             parameters[key] = self.init_parameters[key]
     parameters["filters"] = self.filters
     dfg = parquet_handler.calculate_dfg(".", self.distr_log_path, list_logs, parameters=parameters)
     return {(x.split("@@")[0], x.split("@@")[1]): dfg[x] for x in dfg}
Ejemplo n.º 2
0
def calculate_dfg():
    try:
        process = request.args.get('process', type=str)
        keyphrase = request.args.get('keyphrase', type=str)
        session = request.args.get('session', type=str)
        attribute_key = request.args.get('attribute_key',
                                         type=str,
                                         default=xes.DEFAULT_NAME_KEY)

        use_transition = request.args.get(PARAMETER_USE_TRANSITION,
                                          type=str,
                                          default=str(DEFAULT_USE_TRANSITION))
        no_samples = request.args.get(PARAMETER_NO_SAMPLES,
                                      type=int,
                                      default=DEFAULT_MAX_NO_SAMPLES)

        if use_transition == "True":
            use_transition = True
        else:
            use_transition = False

        if keyphrase == configuration.KEYPHRASE:
            filters = get_filters_per_session(process, session)
            parameters = {}
            parameters["filters"] = filters
            parameters[PARAMETER_USE_TRANSITION] = use_transition
            parameters[PARAMETER_NO_SAMPLES] = no_samples
            parameters[pm4py_constants.
                       PARAMETER_CONSTANT_ATTRIBUTE_KEY] = attribute_key

            returned_dict = parquet_handler.calculate_dfg(
                SlaveVariableContainer.conf,
                process,
                SlaveVariableContainer.managed_logs[process],
                parameters=parameters)

            return jsonify({"dfg": returned_dict})
        return jsonify({"dfg": {}})
    except:
        return traceback.format_exc()