bcda: claim identity across control-number changes, DME VMS→NCH digit and Part D natural keys #1294

Closed
opened 2026-10-25 20:36:16 +00:00 by kert · 1 comment
Owner

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").

  1. Changed control number — the new claim names the previous one in ExplanationOfBenefit.related (we flatten it as clm_orig_cntl_num and write bcda.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.
  2. DME — VMS→NCH drops the leading 1 of CLM-CNTL-NUM; SharedSystem-vs-NCH dedupe compares exact strings. Normalised match key for DME claims.
  3. Part D without a control number — natural key per CCLF Information Packet §5.1.2: 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 in bcda.sync.KEY_EXPR and the connector's pharmacy dedupe.
  • flatten prvdr_srvc_id_qlfyr_cd
  • KEY_EXPR / connector: supersession chain, DME normalisation, PDE natural key
  • ledger count superseded; invariant: no current claim is named as predecessor by another current claim
  • fixtures from the vendored samples for each case
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"). 1. **Changed control number** — the new claim names the previous one in `ExplanationOfBenefit.related` (we flatten it as `clm_orig_cntl_num` and write `bcda.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`. 2. **DME** — VMS→NCH drops the leading `1` of `CLM-CNTL-NUM`; SharedSystem-vs-NCH dedupe compares exact strings. Normalised match key for DME claims. 3. **Part D without a control number** — natural key per CCLF Information Packet §5.1.2: `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 in `bcda.sync.KEY_EXPR` and the connector's pharmacy dedupe. - [ ] flatten `prvdr_srvc_id_qlfyr_cd` - [ ] `KEY_EXPR` / connector: supersession chain, DME normalisation, PDE natural key - [ ] ledger count `superseded`; invariant: no current claim is named as predecessor by another current claim - [ ] fixtures from the vendored samples for each case
kert added this to the P52: BCDA v3 migration — client, crosswalk-driven flatteners, vendored upstream fixtures, proving notebook milestone 2026-10-25 20:36:16 +00:00
kert added the datapipeline labels 2026-10-25 20:36:16 +00:00
Author
Owner

Done in 2cc1300: new columns clm_cntl_num_match, clm_natural_key, prvdr_srvc_id_qlfyr_cd, superseded_by; sync.KEY_EXPR keys claims match → control number → natural key → id; _mark_superseded walks the related chain; 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.

Done in 2cc1300: new columns `clm_cntl_num_match`, `clm_natural_key`, `prvdr_srvc_id_qlfyr_cd`, `superseded_by`; `sync.KEY_EXPR` keys claims match → control number → natural key → id; `_mark_superseded` walks the `related` chain; 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.
kert closed this issue 2026-10-25 21:11:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: homelab/stack#1294