Skip to content

Map CCLF3 procedure codes to icd-10-pcs and icd-9-pcs - #107

Merged
mkrahu-z2 merged 2 commits into
tuva-health:mainfrom
DG47:fix/procedure-code-type-icd-pcs
Oct 30, 2026
Merged

mkrahu-z2 merged 2 commits into
tuva-health:mainfrom
DG47:fix/procedure-code-type-icd-pcs

Conversation

@DG47

@DG47 DG47 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #106. Label: bug.

int_institutional_claim_deduped mapped the CCLF3 DGNS_PRCDR_ICD_IND to icd-10-cm (0) and icd-9-cm (9) for procedure_code_type. Those are the diagnosis code systems. The CCLF3 codes are ICD procedure codes, and the Tuva input layer accepts only icd-10-pcs and icd-9-pcs for procedure_code_type.

 int_institutional_claim_deduped
   procedure_code_type
-    '0' -> 'icd-10-cm', '9' -> 'icd-9-cm'
+    '0' -> 'icd-10-pcs', '9' -> 'icd-9-pcs'
     anything else passes through unchanged

Why it matters: Tuva Core 1.0 normalized__medical_claim_procedures joins terminology__icd_10_pcs on raw_code_system = 'icd-10-pcs' and terminology__icd_9_pcs on 'icd-9-pcs'. With icd-10-cm, neither join matches, so every inpatient ICD procedure from CCLF ended up with a null normalized_code and normalized_description. data_quality__medical_claim_line_flags also flagged every one of those rows as having an invalid procedure_code_type. The diagnosis mapping (diagnosis_code_type) was already correct and is unchanged.

Tests:

  • Unit test int_institutional_claim_deduped_maps_procedure_code_type_to_icd_pcs: one claim with indicator 0 (0DTJ4ZZ) and one with 9 (4701), expecting icd-10-pcs and icd-9-pcs.
  • Fixture test fixture_procedure_code_type_icd_pcs: every medical_claim row with a procedure code has icd-10-pcs or icd-9-pcs. It uses the existing seeds (inpatient claims 0000000001001, 0000000001021 and 0000000001022, which carry 5A1D70Z and 30233N1); no fixture rows change.

Evidence

DuckDB, run locally with the uv-locked toolchain (dbt-core 1.10.20, dbt-duckdb 1.10.1).

  • Before (main 1deb356, with the new tests):
    • fixture_procedure_code_type_icd_pcs FAIL 12: all 12 inpatient rows with procedure codes have icd-10-cm.
    • int_institutional_claim_deduped_maps_procedure_code_type_to_icd_pcs FAIL: got icd-10-cm and icd-9-cm.
  • After:
    • Connector build (build --full-refresh --select package:medicare_cclf_connector package:integration_tests --exclude package:integration_tests,resource_type:seed --indirect-selection cautious): PASS=109 WARN=0 ERROR=0 SKIP=0.
    • Unit tests (test --select "package:medicare_cclf_connector,test_type:unit"): PASS=18 WARN=0 ERROR=0.
    • uv lock --check: passes.

Merge Danger

Door: two-way

Blast Radius: procedure_code_type on institutional claims

Users downstream will see icd-10-pcs / icd-9-pcs instead of icd-10-cm / icd-9-cm on institutional rows that carry ICD procedure codes. Tuva Core then normalizes those procedures, so core.procedure gains normalized codes and descriptions for inpatient ICD procedures it previously left null. Anything that filtered on the old icd-10-cm value for procedures would need updating.

int_institutional_claim_deduped mapped DGNS_PRCDR_ICD_IND on the CCLF3
procedure codes to icd-10-cm ('0') and icd-9-cm ('9'), the diagnosis code
systems. The codes are ICD procedure codes, and the Tuva input layer
accepts only icd-10-pcs and icd-9-pcs for procedure_code_type. Tuva Core's
normalized__medical_claim_procedures joins its ICD-10-PCS and ICD-9-PCS
terminology on those values, so every inpatient ICD procedure from CCLF
was left without a normalized code.

Add a unit test for both indicator values and a fixture test that every
medical_claim row with a procedure code has an ICD-PCS code type.
@DG47

DG47 commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@aneiderhiser @thuxuan-vu gentle ping on this one (fixes #106). int_institutional_claim_deduped maps the CCLF3 DGNS_PRCDR_ICD_IND values to icd-10-cm / icd-9-cm, which are the diagnosis code systems. On Tuva 1.0 that leaves CCLF3 procedure codes unmapped in core.procedure. This maps them to icd-10-pcs / icd-9-pcs. It merges cleanly, and the suggested release label is bug.

@mkrahu-z2 mkrahu-z2 added the bug Something isn't working label Oct 30, 2026
@mkrahu-z2
mkrahu-z2 merged commit 4ad4ae3 into tuva-health:main Oct 30, 2026
14 checks passed
@mkrahu-z2 mkrahu-z2 mentioned this pull request Oct 31, 2026
DG47 pushed a commit to DG47/medicare_cclf_connector that referenced this pull request Nov 3, 2026
Patch release with the bug fixes merged since v1.0.0: tuva-health#105, tuva-health#107, tuva-health#109, tuva-health#111.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inpatient ICD procedure codes get procedure_code_type icd-10-cm / icd-9-cm instead of icd-10-pcs / icd-9-pcs

2 participants