Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ vars:
# Set to "ip" for inpatient data or "op" for outpatient data (more info in the README).
record_type: "ip"
# CCSR version numbers from HCUP.
dxccsr_version: "'2023.1'"
prccsr_version: "'2023.1'"
dxccsr_version: "'2025.1'"
prccsr_version: "'2025.1'"

## CMS HCC data mart vars
# The payment_year variable has a default of the current year.
Expand Down Expand Up @@ -258,12 +258,12 @@ seeds:

value_sets:
ccsr:
ccsr__dxccsr_v2023_1_body_systems:
+post-hook: "{{ load_versioned_seed('value_sets','ccsr__dxccsr_v2023_1_body_systems.csv') }}"
ccsr__dxccsr_v2023_1_cleaned_map:
+post-hook: "{{ load_versioned_seed('value_sets','ccsr__dxccsr_v2023_1_cleaned_map.csv') }}"
ccsr__prccsr_v2023_1_cleaned_map:
+post-hook: "{{ load_versioned_seed('value_sets','ccsr__prccsr_v2023_1_cleaned_map.csv') }}"
ccsr__dxccsr_v2025_1_body_systems:
+post-hook: "{{ load_versioned_seed('value_sets','ccsr__dxccsr_v2025_1_body_systems.csv') }}"
ccsr__dxccsr_v2025_1_cleaned_map:
+post-hook: "{{ load_versioned_seed('value_sets','ccsr__dxccsr_v2025_1_cleaned_map.csv') }}"
ccsr__prccsr_v2025_1_cleaned_map:
+post-hook: "{{ load_versioned_seed('value_sets','ccsr__prccsr_v2025_1_cleaned_map.csv') }}"
ahrq_measures:
pqi__measures:
+post-hook: "{{ load_versioned_seed('value_sets','ahrq_measures__pqi_measures.csv') }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ with ccs_release_year as (
and g.duplicate_row_number = 1
inner join {{ ref('encounters__patient_data_source_id') }} as d on m.person_id = d.person_id
and m.data_source = d.data_source
left outer join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} as dx on m.diagnosis_code_1 = dx.icd_10_cm_code
left outer join {{ ref('ccsr__dxccsr_v2025_1_cleaned_map') }} as dx on m.diagnosis_code_1 = dx.icd_10_cm_code
left outer join {{ ref('provider_data__provider') }} as p on m.facility_npi = p.npi
left outer join {{ ref('terminology__nitos') }} as n on m.hcpcs_code = n.hcpcs_code
left outer join {{ ref('terminology__ms_drg') }} as msdrg on m.drg_code_type = 'ms-drg' and m.drg_code = msdrg.ms_drg_code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ with ccs_release_year as (
, n.modality
, m.data_source
from {{ ref('normalized_input__medical_claim') }} as m
left outer join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} as dx on m.diagnosis_code_1 = dx.icd_10_cm_code
left outer join {{ ref('ccsr__dxccsr_v2025_1_cleaned_map') }} as dx on m.diagnosis_code_1 = dx.icd_10_cm_code
left outer join {{ ref('provider_data__provider') }} as p on m.facility_npi = p.npi
left outer join {{ ref('terminology__nitos') }} as n on m.hcpcs_code = n.hcpcs_code
left outer join {{ ref('terminology__revenue_center') }} as r on m.revenue_center_code = r.revenue_center_code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ inner join first_last as fl on e.person_id = fl.person_id
er.data_source = fl.data_source
and
fl.year_nbr = c.year
left outer join {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }} as ccsr on e.primary_diagnosis_code = ccsr.icd_10_cm_code
left outer join {{ ref('ccsr__dxccsr_v2025_1_cleaned_map') }} as ccsr on e.primary_diagnosis_code = ccsr.icd_10_cm_code
left outer join {{ ref('reference_data__ansi_fips_state') }} as st_ab on p.state = st_ab.ansi_fips_state_abbreviation
left outer join {{ ref('reference_data__ansi_fips_state') }} as st_full on p.state = st_full.ansi_fips_state_name
left outer join {{ ref('terminology__race') }} as r on p.race = r.description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ with ccsr__dx_vertical_pivot as (

, dxccsr_body_systems as (

select * from {{ ref('ccsr__dxccsr_v2023_1_body_systems') }}
select * from {{ ref('ccsr__dxccsr_v2025_1_body_systems') }}

)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with codes as (
{%- endfor %}
, default_ccsr_category_ip
, default_ccsr_category_op
from {{ ref('ccsr__dxccsr_v2023_1_cleaned_map') }}
from {{ ref('ccsr__dxccsr_v2025_1_cleaned_map') }}

)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ select
, ont.device
, ont.qualifier
, cast('{{ var('tuva_last_run') }}' as {{ dbt.type_timestamp() }}) as tuva_last_run
from {{ ref('ccsr__prccsr_v2023_1_cleaned_map') }} as ccsr_map
from {{ ref('ccsr__prccsr_v2025_1_cleaned_map') }} as ccsr_map
left outer join {{ ref('terminology__icd10_pcs_cms_ontology') }} as ont
on ccsr_map.icd_10_pcs = ont.icd10pcs_code
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ left outer join cte on e.facility_npi = cte.location_id
left outer join {{ ref('ccsr__dx_vertical_pivot') }} as p
on e.primary_diagnosis_code = p.code
and p.ccsr_category_rank = 1
left outer join {{ ref('ccsr__dxccsr_v2023_1_body_systems') }} as b on p.ccsr_parent_category = b.ccsr_parent_category
left outer join {{ ref('ccsr__dxccsr_v2025_1_body_systems') }} as b on p.ccsr_parent_category = b.ccsr_parent_category
where e.encounter_type = 'emergency department'
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ with cte as (
left outer join {{ ref('ccsr__dx_vertical_pivot') }} as p
on e.primary_diagnosis_code = p.code
and p.ccsr_category_rank = 1
left outer join {{ ref('ccsr__dxccsr_v2023_1_body_systems') }} as b
left outer join {{ ref('ccsr__dxccsr_v2025_1_body_systems') }} as b
on p.ccsr_parent_category = b.ccsr_parent_category
left outer join {{ ref('terminology__ms_drg_weights_los') }} as weights
on e.drg_code = weights.ms_drg and {{ date_part('year', 'e.encounter_start_date') }} = cast (weights.fiscal_year as {{ dbt.type_numeric() }})
Expand Down
41 changes: 41 additions & 0 deletions seeds/value_sets/ccsr/README_v2025_1_publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# CCSR v2025.1 seed data β€” publish to S3 before release

The CCSR seeds in this folder are header-only. Their data is loaded at
`dbt seed` time from the versioned `value-sets` bundle in public object storage
via the `load_versioned_seed` post-hooks in `dbt_project.yml`.

**This update bumps the CCSR mart from v2023.1 to v2025.1.** The v2025.1 data
files are NOT yet published to object storage. Until they are published, any
`dbt seed`/`dbt build` (including CI) will fail to load these three seeds.

## Required before merge / release

Publish these gzipped files to the `value-sets` bundle in all mirrored buckets
(S3, GCS, Azure), alongside the existing `value-sets/<bundle-version>/` files:

- `ccsr__dxccsr_v2025_1_body_systems.csv.gz`
- `ccsr__dxccsr_v2025_1_cleaned_map.csv.gz`
- `ccsr__prccsr_v2025_1_cleaned_map.csv.gz`

Object keys must match the post-hook filenames, e.g.
`s3://tuva-public-resources/value-sets/<bundle-version>/ccsr__dxccsr_v2025_1_cleaned_map.csv.gz`.
Bump `tuva_seed_versions.value_sets` if publishing under a new bundle version.

## Source and transformation

Generated from HCUP CCSR v2025-1 (ICD-10 codes valid through 2025-09-30):

- DXCCSR: `DXCCSR_v2025-1.zip` -> `DXCCSR_v2025-1.csv`
- PRCCSR: `PRCCSR_v2025-1.zip` -> `PRCCSR_v2025-1.csv`
- https://hcup-us.ahrq.gov/toolssoftware/ccsr/dxccsr.jsp
- https://hcup-us.ahrq.gov/toolssoftware/ccsr/prccsr.jsp

Cleaning applied to match the seed schema: strip the single quotes wrapping
codes, rename headers to snake_case, drop the DXCCSR "Rationale for Default
Assignment" column, and convert empty CCSR category cells to null. Row counts:
dxccsr cleaned map 75,238; prccsr cleaned map 82,121; body_systems 22.

`ccsr__dxccsr_v2025_1_body_systems` was carried over from v2023.1 (the CCSR
parent-category set is stable). Re-verify the parent-category counts in each
`parent_category_description` against `DXCCSR-Reference-File-v2025-1.xlsx`
before release.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body_system,ccsr_parent_category,parent_category_description
Original file line number Diff line number Diff line change
@@ -1 +1 @@
icd_10_cm_code,icd_10_cm_code_description,default_ccsr_category_ip,default_ccsr_category_description_ip,default_ccsr_category_op,default_ccsr_category_description_op,ccsr_category_1,ccsr_category_1_description,ccsr_category_2,ccsr_category_2_description,ccsr_category_3,ccsr_category_3_description,ccsr_category_4,ccsr_category_4_description,ccsr_category_5,ccsr_category_5_description,ccsr_category_6,ccsr_category_6_description
icd_10_cm_code,icd_10_cm_code_description,default_ccsr_category_ip,default_ccsr_category_description_ip,default_ccsr_category_op,default_ccsr_category_description_op,ccsr_category_1,ccsr_category_1_description,ccsr_category_2,ccsr_category_2_description,ccsr_category_3,ccsr_category_3_description,ccsr_category_4,ccsr_category_4_description,ccsr_category_5,ccsr_category_5_description,ccsr_category_6,ccsr_category_6_description
12 changes: 6 additions & 6 deletions seeds/value_sets/ccsr/ccsr_seeds.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: 2

seeds:
- name: ccsr__dxccsr_v2023_1_body_systems
- name: ccsr__dxccsr_v2025_1_body_systems
description: |
A table containing descriptions of the top level categories used in the CCSR condition mapper.
This was manually extracted from the User Guide PDF included with the DXCCSR SAS program.
config:
schema: |
{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_value_sets{% else %}value_sets{%- endif -%}
alias: _value_set_dxccsr_v2023_1_body_systems
alias: _value_set_dxccsr_v2025_1_body_systems
tags:
- ccsr
enabled: "{{ var('claims_enabled', var('clinical_enabled', False)) }}"
Expand All @@ -27,15 +27,15 @@ seeds:
- name: parent_category_description
description: Description of the parent category in the CCSR condition mapper.

- name: ccsr__dxccsr_v2023_1_cleaned_map
- name: ccsr__dxccsr_v2025_1_cleaned_map
description: |
A table containing the CSV mapping file included with the DXCCSR SAS program.
The original CSV was not natively seedable, and the file was transformed with the coded included in the README.
For each ICD-10-CM code, the table contains up to six CCSR category codes and a default CCSR category code.
config:
schema: |
{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_value_sets{% else %}value_sets{%- endif -%}
alias: _value_set_dxccsr_v2023_1_cleaned_map
alias: _value_set_dxccsr_v2025_1_cleaned_map
tags:
- ccsr
enabled: "{{ var('claims_enabled', var('clinical_enabled', False)) }}"
Expand Down Expand Up @@ -117,14 +117,14 @@ seeds:
- name: ccsr_category_6_description
description: Description of the sixth CCSR category code

- name: ccsr__prccsr_v2023_1_cleaned_map
- name: ccsr__prccsr_v2025_1_cleaned_map
description: |
A table containing the CSV mapping file included with the PRCCSR SAS program.
The original CSV was not natively seedable, and the file was transformed with the coded included in the README.
config:
schema: |
{%- if var('tuva_schema_prefix',None) != None -%}{{var('tuva_schema_prefix')}}_value_sets{% else %}value_sets{%- endif -%}
alias: _value_set_prccsr_v2023_1_cleaned_map
alias: _value_set_prccsr_v2025_1_cleaned_map
tags:
- ccsr
enabled: "{{ var('claims_enabled', var('clinical_enabled', False)) }}"
Expand Down