Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new_trace_start, avg_events_in_log, std_var_events_in_log, trace_ids_in_log, traces_in_log
logger = logging.getLogger(__name__)
def import_log_csv(path):
return conversion_factory.apply(
import_event_stream(path), # https://pm4py.fit.fraunhofer.de/documentation/1.2
parameters={constants.PARAMETER_CONSTANT_CASEID_KEY: "case:concept:name", # this tells the importer
constants.PARAMETER_CONSTANT_ACTIVITY_KEY: "concept:name", # how to parse the csv
constants.PARAMETER_CONSTANT_TIMESTAMP_KEY: "time:timestamp"} # and which are the caseID
) # concept name and timestamp
import_log = {
'.csv': import_log_csv,
'.xes': import_log_xes
}
export_log = {
'.csv': export_log_csv,
'.xes': export_log_xes
}
def create_log(log, name: str, folder='cache/log_cache/', import_in_cache=True):
logger.info('\tCreating new file (' + name + ') in memory')
if import_in_cache:
name = create_unique_name(name)
path = folder + name
if import_in_cache:
if isinstance(log, EventLog):
export_log[pathlib.Path(name).suffixes[0]](log, path)
def progetto_padova():
JOB = Job.objects.get_or_create(
status=JobStatuses.CREATED.value,
type=JobTypes.PREDICTION.value,
split=Split.objects.get_or_create( # this creates the split of the log
type=SplitTypes.SPLIT_DOUBLE.value,
train_log=create_log( # this imports the log
import_log(BASE_DIR + RELATIVE_TRAIN_PATH),
RELATIVE_TRAIN_PATH,
BASE_DIR,
import_in_cache=False
),
test_log=create_log( # this imports the log
import_log(BASE_DIR + RELATIVE_VALIDATION_PATH),
RELATIVE_VALIDATION_PATH,
BASE_DIR,
import_in_cache=False
)
)[0],
encoding=Encoding.objects.get_or_create( # this defines the encoding method
data_encoding=DataEncodings.LABEL_ENCODER.value,
value_encoding=ValueEncodings.SIMPLE_INDEX.value,
add_elapsed_time=False,
add_remaining_time=False,
add_executed_events=False,
add_resources_used=False,
add_new_traces=False,
prefix_length=5,
padding=True,
task_generation_type=TaskGenerationTypes.ALL_IN_ONE.value,