Objective
- Fix Required Info field columns selected in Reports Hub exporting with no data in the downloaded file.
- Ensure
requiredInfoValuesare correctly projected, resolved, and written to export rows for all export entity types that support Required Info columns.
Background
- Catherine Lemoine (SE/Residential) reported that selecting Required Info fields in Reports Hub and running an export produces a file where those columns are blank or missing.
- The export completes without error — the fields appear to be recognized by the UI but arrive empty in the CSV/XLSX output.
- The export pipeline in
attik-backendhas a distinct path for Required Info columns: they are identified by aREQUIRED_INFO_VALUE_PREFIXon the column key, the backend addsrequiredInfoValuesto the MongoDB projection, andtransformDataresolves each cell by matching_requiredInfoIdwithin the document'srequiredInfoValuesarray. - Entity scope gap (hypothesis A):
buildSingleEntityProjectiononly addsrequiredInfoValuesto the projection whentargetEntityisinspectionsorquotes. If the export is run on any other entity, the field is silently absent from all fetched documents, producing empty cells with no error. - ID match failure (hypothesis B): If the column key prefix-stripping or
_requiredInfoIdcomparison fails (e.g. ObjectId string vs. string type mismatch),entryis undefined andrawValuedefaults to''. - Missing
requiredInfoValueson records (hypothesis C): Jobs predating when Required Info was introduced may not have the array populated. - The export entity Catherine was running is unknown — this is an open repro variable.
Product Decisions
Locked
- Required Info columns are currently supported only on
inspectionsandquotesentity exports — this is intentional perbuildSingleEntityProjection.
Open
- Entity scope — If Catherine was running a non-
inspections/quotesexport, is the correct fix to silently drop RI columns with a UI warning, block RI column selection for unsupported entities, or expand RI support to additional entities? - Repro confirmation — Engineering needs to confirm which export entity and which specific Required Info fields Catherine had selected before fixing.
Scope
Backend (attik-backend / attik monorepo)
src/routes/dataExport.ts(apps/backend/src/routes/dataExport.ts) — route handler;buildSingleEntityProjectioncontrols whetherrequiredInfoValuesis added to the projection;getSingleEntityHeaderDatacallsgetRequiredInfoLabelssrc/util/functions/dataExports/documentResolution.ts—transformDatafunction; the Required Info cell resolution loop atcolumn.startsWith(REQUIRED_INFO_VALUE_PREFIX); the_requiredInfoIdmatch againstdoc.requiredInfoValuessrc/util/functions/dataExports/filterBuilders.ts— definesREQUIRED_INFO_VALUE_PREFIXandSPECIAL_RULE_PATHS
Frontend (attik-frontend / attik monorepo)
src/app/tools/data-exports/CreateReportForm.tsx(apps/frontend/src/app/tools/data-exports/CreateReportForm.tsx) — column selection UI; how RI fields are added to the columns payload sent to the backendsrc/app/tools/data-exports/constants.ts(apps/frontend/src/app/tools/data-exports/constants.ts) — column key construction; confirmREQUIRED_INFO_VALUE_PREFIXis correctly applied when building the payload