sdac-cross-reference-replacements
Purpose
Cross-checks replacement comments against main roster positions and flags mismatches.
Tool type
Deterministic (rule-based)
Tool ID
sdac-cross-reference-replacements
Inputs
report_id(string)record_ids(number[], optional)
Outputs
errorsandwarningsfor missing or inconsistent replacement references
Example output
{
"success": true,
"report_id": "SDAC-2024-Q2-001",
"passed": false,
"error_count": 1,
"warning_count": 1,
"errors": [
{
"rule_id": "REPLACEMENT_INVALID_LINK",
"row_number": 72,
"message": "Replacement references row 999, which is not a main roster row.",
"severity": "ERROR"
}
],
"warnings": [
{
"rule_id": "REPLACEMENT_MISSING_COMMENT",
"row_number": 73,
"message": "Replacement record should include a comment linking to the main roster.",
"severity": "WARNING"
}
]
}
Functional details
- Matches replacement comments to main roster rows by row number or name.
- Flags unclear or missing references.
- Highlights job title and cost pool mismatches.
Implementation details
- Parses row references from comments (supports
row,row#,#). - Matches replacements by row number first, then by normalized name lookup.
- Emits
REPLACEMENT_REFERENCE_NOT_FOUND,REPLACEMENT_REFERENCE_UNCLEARfor weak links. - Flags cost pool/job title mismatches with
REPLACEMENT_COST_POOL_MISMATCHandREPLACEMENT_JOB_TITLE_MISMATCH. - Normalizes names by stripping non-alphanumerics to improve fuzzy matches.
Code Location: packages/domain-sdac/src/tools/cross-reference-replacements.tool.ts