Skip to content

Commit a5649c4

Browse files
committed
fix: pm4py converts datetime to string XML tag, needed date XML tag instead
1 parent 8171458 commit a5649c4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/build_test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
name: Build & Test
2+
13
on:
24
workflow_dispatch:
35
push:
@@ -28,7 +30,7 @@ jobs:
2830
- name: Upload built packages
2931
uses: actions/upload-artifact@v3
3032
with:
31-
name: build-{{ matrix.python-version }}
33+
name: build-${{ matrix.python-version }}
3234
path: dist
3335
- name: Test
3436
run: |

src/pm4py_wrapper/wrapper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
from xml.etree import ElementTree
23

34
import pandas as pd
45
import pm4py
@@ -19,3 +20,10 @@ def convert_csv_to_xes(csv_path: Path, output_path: Path):
1920
log = log_converter.apply(df, variant=log_converter.Variants.TO_EVENT_LOG)
2021
log_lifecycle = interval_lifecycle.to_lifecycle(log)
2122
xes_exporter.apply(log_lifecycle, str(output_path))
23+
24+
# fixing the timestamp XML tag after pm4py conversion
25+
ElementTree.register_namespace('', 'http://www.xes-standard.org/')
26+
root = ElementTree.parse(str(output_path))
27+
for elem in root.findall(".//*[@key='time:timestamp']"):
28+
elem.tag = 'date'
29+
root.write(str(output_path), encoding='utf-8', xml_declaration=True)

0 commit comments

Comments
 (0)