forked from SWISDATA/processintel
converters.csv_to_xes: dates are parsed ambiguously (month-first, per value) #27
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
ffrauenberger/ProcessIntel#27
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: critical (the review of #1 found 2,901 of 7,548 timestamps of the bundled example written wrongly into the XES)
Where
app/converters/csv_to_xes_converter.py:208-239Problem
After one hard-coded format (
%d-%m-%Y:%H.%M), the converter falls back topd.to_datetime(timestamps, format="mixed"). This parses each value separately with month-first precedence. Timezone-naive values are written without an offset, so consumers interpret them in their own local time.Steps to reproduce
03.04.2024and13.04.2024Expected behavior
All values are parsed with one consistent format (here day-first: April 3rd and April 13th), or the user is asked for the format.
Actual behavior
03.04.2024becomes March 4th and13.04.2024becomes April 13th: an inconsistent mix of interpretations, without any warning.Found in the review of #1
tests/testcsv/CallcenterExample.csv, 2,901 of 7,548 timestamps are written wrongly into the XES. Only%d-%m-%Y:%H.%Mis tried explicitly; everything else falls back toformat="mixed", which reads9.3.10as 3 September.csv_to_xes_converter.py:307-308,group.sort_values(by=actual_timestamp_col)withoutkind="stable"), so tied events in a case are reordered.Related: #1.
Fix
Infer one format for the whole column (or ask the user), parse with
dayfirstexplicitly, and report values that could not be parsed. Reuse the same parsing for mining (#1).from
issues/BUG-027-csv-to-xes-ambiguous-date-parsing.md(code analysis of commit6bcc646, 2026-10-03)Reviewed by Codex (GPT-6) against origin/main
6bcc646eb464.Review: partially correct.
The month-first ambiguity, 2,901/7,548 fixture differences and unstable conversion sort are supported. Please qualify the timezone statement: timezone-naive output has no specified offset, but consumers do not universally interpret it in local time. This application's own XES importer uses
pd.to_datetime(..., utc=True)(xes_to_csv_converter.py:148), which interprets naive values as UTC. Export should obtain an explicit timezone/offset or document its policy; consumer behavior must not be assumed.Code references: app/converters/csv_to_xes_converter.py:237, app/converters/xes_to_csv_converter.py:148.