[FEATURE]: CSV Parsing + Delimiter Auto-Detection + BOM Handling #331

Closed
opened 2026-01-07 13:46:02 +01:00 by carla · 0 comments
Owner

Description

Parse CSV robustly with correct delimiter detection and BOM handling.

Tasks:

  • Verify/add NimbleCSV dependency ({:nimble_csv, "~> 1.0"})
  • Create lib/mv/membership/import/csv_parser.ex
  • Implement strip_bom/1 and apply it before any header handling
  • Handle \r\n and \n line endings (trim \r on header record)
  • Detect delimiter via header recognition (try ; and ,)
  • Parse CSV and return:
    • headers :: [String.t()]
    • rows :: [{csv_line_number, [String.t()]}] or directly [{csv_line_number, row_map}]
  • Skip completely empty records (but preserve correct physical line numbers)
  • Return {:ok, headers, rows} or {:error, reason}

Acceptance criteria

  • BOM handling works (Excel exports)
  • Delimiter detection works reliably
  • Rows carry correct csv_line_number

External or internal Dependencies

Issue #329

## Description Parse CSV robustly with correct delimiter detection and BOM handling. **Tasks:** - [x] Verify/add NimbleCSV dependency (`{:nimble_csv, "~> 1.0"}`) - [x] Create `lib/mv/membership/import/csv_parser.ex` - [x] Implement `strip_bom/1` and apply it **before** any header handling - [x] Handle `\r\n` and `\n` line endings (trim `\r` on header record) - [x] Detect delimiter via header recognition (try `;` and `,`) - [ ] Parse CSV and return: - `headers :: [String.t()]` - `rows :: [{csv_line_number, [String.t()]}]` or directly `[{csv_line_number, row_map}]` - [x] Skip completely empty records (but preserve correct physical line numbers) - [x] Return `{:ok, headers, rows}` or `{:error, reason}` ## Acceptance criteria - [x] BOM handling works (Excel exports) - [x] Delimiter detection works reliably - [x] Rows carry correct `csv_line_number` ## External or internal Dependencies Issue #329
carla added this to the I can import members milestone 2026-01-07 13:46:02 +01:00
carla added the
M
label 2026-01-07 13:46:02 +01:00
carla added a new dependency 2026-01-07 13:46:41 +01:00
carla added this to the Sprint 11: 08.01-29.01 project 2026-01-08 12:54:41 +01:00
carla self-assigned this 2026-01-14 12:32:20 +01:00
carla closed this issue 2026-01-15 13:38:37 +01:00
Sign in to join this conversation.
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.

Depends on
Reference: local-it/mitgliederverwaltung#331
No description provided.