The Mass Import module turns "give us your Excel file" into a 5-minute operation for hospitals migrating their existing equipment register into HEMMS. A 200-bed hospital typically has 800–2,000 medical devices, 30–80 vendors, and 15–40 departments already tracked in Excel — manual entry is unrealistic and produces transcription errors that silently corrupt the HA Annual PM Report.
Equipment, Vendors, Locations (one file per object, one object per file)
Server-generated XLSX templates
Always in sync with the live model schema; localised headers (TH/EN) follow the user's session lang
Full-simulation dry-run
Parses → resolves FKs → checks uniqueness → MoPH match → per-row OK / WARN / FAIL verdict, with no DB writes
Idempotent re-import
Business-key match upserts existing records — re-running the same file yields 0 new, N updated
Strict MoPH 82-class match
Exact match against the Q5 seed (case-sensitive on EN, NFC-normalised); fuzzy matches REJECTED to protect HA-report data quality
Batch-tagged delete
Every imported record carries roots_hemms_import_batch_id; user can undo a recent batch in one click (within 7 days, if no downstream PM events or contracts reference the records)
Error XLSX export
Failed rows downloadable as a single-sheet XLSX with Row / Verdict / Field / Severity / Message / Raw Value
Transactional commit
cr.savepoint()-wrapped, all-or-nothing — any write-time error rolls back the entire batch