Beispiel #1
0
def read_event_log_file(log_filepath):
    if not os.path.isfile(log_filepath):
        raise ValueError('{} is not a log file!'.format(log_filepath))

    with open(log_filepath, 'r') as f:
        logs = XUniversalParser.parse(f)
        log = logs[0]

    return log
Beispiel #2
0
def xlog():
    xlog_fp = os.path.join('.', 'tests', 'testdata', 'BPIC2012.xes.gz')
    start = time.time()
    with open(xlog_fp, 'r') as f:
        xlog = XUniversalParser.parse(f)[0]
        size = sys.getsizeof(xlog)
        print('BPIC2012 XLog size: {}b'.format(size))
    diff = time.time() - start
    print('Took {} secs to parse BPIC2012'.format(diff))
    return xlog
Beispiel #3
0
    #preprocess file
    #os.mkdir(secure_token)
    print("\n Starting privatize_df.py \n")
    outPath = filePath.replace(".xes","_%s.xes" % (epsilon))
    log = xes_import_factory.apply(filePath)


    parser = XUniversalParser()

    if parser.can_parse(filePath):
        print("log can be parsed.")
    else:
        print("log can not be parsed.")

    log_file = open(filePath)
    log_list = parser.parse(log_file)
    #log = log_list[0]

    event_mapping = create_event_int_mapping(log)
    privatize_df(log_list, event_mapping, epsilon, outPath)

    #write to db
    print("Writing to DB")
    print(outPath)
    puffer,targetFile = outPath.split("media"+os.path.sep)
    conn = sqlite3.connect(dbName)
    c = conn.cursor()
    c.execute("UPDATE eventlogUploader_document SET status = ?, docfile = ? WHERE token = ?", ("FINISHED", targetFile, secure_token))
    conn.commit()
    conn.close()