bcda: claim identity across control-number changes, DME VMS→NCH digit and Part D natural keys #1294
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Upstream review docs/superpowers/specs/2026-10-25-bcda-upstream-review.md §B (bcda.cms.gov Partially adjudicated claims data, "Matching multiple EOBs to the same claim").
ExplanationOfBenefit.related(we flatten it asclm_orig_cntl_numand writebcda.eob_supersession), but current state keeps the predecessor as a separate claim and the connector counts both. Walk the chain (institutional claims carry only the immediate parent); mark_superseded_by; exclude from current counts and from_stg_claim_header.1ofCLM-CNTL-NUM; SharedSystem-vs-NCH dedupe compares exact strings. Normalised match key for DME claims.CLM_LINE_FROM_DT,PRVDR_SRVC_ID_QLFYR_CD(not flattened today),CLM_SRVC_PRVDR_GNRC_ID_NUM,CLM_LINE_RX_SRVC_RFRNC_NUM,CLM_LINE_RX_FILL_NUM. Use it as the PDE fallback inbcda.sync.KEY_EXPRand the connector's pharmacy dedupe.prvdr_srvc_id_qlfyr_cdKEY_EXPR/ connector: supersession chain, DME normalisation, PDE natural keysuperseded; invariant: no current claim is named as predecessor by another current claimDone in
2cc1300: new columnsclm_cntl_num_match,clm_natural_key,prvdr_srvc_id_qlfyr_cd,superseded_by;sync.KEY_EXPRkeys claims match → control number → natural key → id;_mark_supersededwalks therelatedchain; new invariant; connector dedupes on the same identity and drops superseded rows; legacy partitions get the columns as NULLs. Tests: supersession chain, VMS→NCH digit, Part D natural key, legacy tables.