Skip to content

Enhancement: Broaden auto-detection for column mapping #16

@pluginpath-ops

Description

@pluginpath-ops

Problem

The CSV field auto-mapper only recognises a header as the charge rate / kW column if it contains both "charge" and "rate" (case-insensitive). Real-world CSV exports use a wider range of names for this field and currently require the user to manually select the mapping.

Examples of headers that should auto-map to Charge Rate (kW)

Header seen in the wild Rationale
Power / power Generic electrical power term
Power (kW) / Power_kW Explicitly unit-labelled
kilowatts / Kilowatts Full word form
kW / KW / kw Abbreviation only
ChargeKW / charge_kw Compound without space
ChargePower / charge_power Power variant

Examples of headers that should auto-map to SoC

Header seen in the wild Rationale
SoC / soc Most accurate term
Charge / charge Generally accurate
% / percent Full word form

Examples of headers that should auto-map to time

Header seen in the wild Rationale
Time / time Most accurate term
Minutes / minutes Generally accurate
Charging Time / charging_time Full word form
mins / MIN Abbreviation only

Proposed change

Extend the autoMapping heuristic in parseCSV / handleFileUpload in RunsView.jsx

The \bkw\b word-boundary regex prevents false matches like "skwer" while still matching "Power (kW)" (because "kw" appears as a token inside the parentheses).

Acceptance criteria

  • Power → auto-maps to kW
  • Power (kW) → auto-maps to kW
  • kilowatts → auto-maps to kW
  • kW alone → auto-maps to kW
  • ChargeRate (existing behaviour) still maps correctly
  • Unrelated columns (Voltage, Amps) do not false-positive

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions