Cross-cutting · CSV import engine

The shared engine behind every bulk import in the product: upload a CSV, auto-map its headers to model attributes, choose the separator, the match key, the date format, consent defaults and channels, preview and import — with the file stored server-side and the job queued as a load record.

AreaCross-cutting
Routescrm.users.import · crm.users.import-children · crm.commerces.import · configuration.influence-zones.import · intranet.flows.import
Centre modulesalways available
Staff levelsroot · admin
Modelsload · load-common
UI labelimport-csv.column-database
Coverage4 use cases · 1 happy · 8 failure

Known issues (1)

How it works

Two implementations coexist: the older import-csv component (modal-based, fixed ; delimiter, 120 lines) and the newer nf-import (606 lines, full page, configurable separator and primary key, preview table, template download, canImportChildren/canRemoveUserTypes affordances and a pre-flight error summary). Both drive the same load model, whose three validations are the real contract: no duplicate column mappings, a date format whenever a date column is mapped, and at least one channel for user imports. parseCSV parses and uploads in parallel (Promise.all), so the mapping table and the stored file are produced in one step. update: true switches between insert-only and update-and-insert.

Use cases

Why someone opens this (4)

  • Migrating a legacy customer or store database during onboarding.
  • Periodic bulk updates from a POS, HR or counting system.
  • Loading reference data such as postal-code-to-zone mappings.
  • Giving a non-technical user a safe, previewable alternative to an API integration.

Path map

flowchart LR
    F(["CSV import engine"]):::feat
    F --> H1["Template import with preview"]:::ok
    F -.-> X1["Duplicate column mapping"]:::bad
    F -.-> X2["Date column without a format"]:::bad
    F -.-> X3["User import without channels"]:::bad
    F -.-> X4["Pre-flight summary"]:::bad
    F -.-> X5["Upload rejected"]:::bad
    F -.-> X6["Server-side row errors"]:::bad
    F -.-> X7["Parse failure leaves a stuck spinner"]:::bad
    F -.-> X8["Wrong separator chosen"]:::bad
    classDef feat fill:#8c5a3c,stroke:#8c5a3c,color:#ffffff,font-weight:bold
    classDef ok fill:#e3f1ea,stroke:#0d6b42,color:#0d4a2e
    classDef bad fill:#f7e6e2,stroke:#9a2d1c,color:#6e1f13

Happy paths

Template import with preview

  1. User downloads the entity’s example CSV (which varies by centre configuration) and fills it.
  2. Uploads the file; it is parsed and stored in parallel.
  3. Headers matching attribute names are mapped automatically; the rest are mapped by hand.
  4. Separator, match key, date format, consents and channels are set.
  5. The preview table shows how rows will be interpreted.
  6. load.validate() passes, load.save() queues the job and the success state is reported.

Failure paths

QA checklist

Tick these off while regression-testing this feature. The boxes are plain Markdown, so progress is visible in git diffs.

  • ✅ Template import with preview
  • ⛔ Duplicate column mapping
  • ⛔ Date column without a format
  • ⛔ User import without channels
  • ⛔ Pre-flight summary
  • ⛔ Upload rejected
  • ⛔ Server-side row errors
  • ⛔ Parse failure leaves a stuck spinner
  • ⛔ Wrong separator chosen

Implementation


Generated from doc/feature-inventory.json · id xc-csv-import-engine · commit 276788ca6