feat(contacts): backfill existing company industries to canonical set (PMS-602) #413
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-602-backfill-company-industries"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PMS-602 (follow-up to PMS-601)
PMS-582 standardized NEW company Industry entries; rows created earlier keep whatever free text was typed ("IT", "I.T.", "Information Technology"). This adds a one-time, re-runnable backfill that normalizes existing values to the canonical PMS-601 set so reporting/filtering on industry is clean across all data.
What it does
mokosh-bootstrap normalize-company-industries(cross-tenant operator task, privileged DATABASE_URL):companies.industrywhose normalized form (lower(btrim(...))) matches a curated variant via avariant -> canonicalmap (e.g. it / i.t. / infotech / technology -> "Information Technology"; health care / medical -> "Healthcare"; etc.).Decisions the ticket asked for
Commits
normalize_company_industriesbackfill function + variant map (contacts module).normalize-company-industriesbootstrap subcommand + help.Verified on the dev DB
Inserted messy rows; the command reported:
normalized 2 ... across 1 tenant(I.T.->Information Technology,health care->Healthcare), leftFintech Widgetsunmapped+reported, and a re-run wasnormalized 0(idempotent). Test rows cleaned up. Compile + fmt + clippy clean; unit tests pass.Operating
Run once per environment after deploy:
mokosh-bootstrap normalize-company-industries(reads DATABASE_URL). Review any reported unmapped values and either add a mapping or fix them from Settings > Company Industries.🤖 Generated with Claude Code