converters.csv_to_xes: dates are parsed ambiguously (month-first, per value) #27

Open
opened 2026-10-06 13:49:00 +00:00 by ffrauenberger · 1 comment
Owner

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-239

Problem

After one hard-coded format (%d-%m-%Y:%H.%M), the converter falls back to pd.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

  1. Use the CSV to XES converter on a CSV whose timestamp column contains European dates such as 03.04.2024 and 13.04.2024
  2. Inspect the timestamps in the generated XES

Expected 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.2024 becomes March 4th and 13.04.2024 becomes April 13th: an inconsistent mix of interpretations, without any warning.

Found in the review of #1

  • On tests/testcsv/CallcenterExample.csv, 2,901 of 7,548 timestamps are written wrongly into the XES. Only %d-%m-%Y:%H.%M is tried explicitly; everything else falls back to format="mixed", which reads 9.3.10 as 3 September.
  • The conversion also sorts unstably (csv_to_xes_converter.py:307-308, group.sort_values(by=actual_timestamp_col) without kind="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 dayfirst explicitly, 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 commit 6bcc646, 2026-10-03)

**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-239` ## Problem After one hard-coded format (`%d-%m-%Y:%H.%M`), the converter falls back to `pd.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 1. Use the CSV to XES converter on a CSV whose timestamp column contains European dates such as `03.04.2024` and `13.04.2024` 2. Inspect the timestamps in the generated XES ### Expected 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.2024` becomes March 4th and `13.04.2024` becomes April 13th: an inconsistent mix of interpretations, without any warning. ### Found in the review of #1 - On `tests/testcsv/CallcenterExample.csv`, 2,901 of 7,548 timestamps are written wrongly into the XES. Only `%d-%m-%Y:%H.%M` is tried explicitly; everything else falls back to `format="mixed"`, which reads `9.3.10` as 3 September. - The conversion also sorts unstably (`csv_to_xes_converter.py:307-308`, `group.sort_values(by=actual_timestamp_col)` without `kind="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 `dayfirst` explicitly, 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 commit 6bcc646, 2026-10-03)
Author
Owner

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.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **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](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/converters/csv_to_xes_converter.py#L237), [app/converters/xes_to_csv_converter.py:148](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/converters/xes_to_csv_converter.py#L148).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#27
No description provided.