Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
else:
default_storage.save(path, ContentFile(log.read()))
log = import_log[pathlib.Path(name).suffixes[0]](path)
else: # TODO: this might be risky