Skip to content

Commit a0fabc5

Browse files
committed
Add SNPNE (SNP New Enrollee) scoring model support
Propagate institutional_snp_flag from core eligibility through the CMS-HCC pipeline (stg_eligibility → int_members → int_demographic_factors). SNP New Enrollees are now scored with SNPNE-specific coefficients (risk_model_code = 'SNPNE') instead of regular NE coefficients. The seed demographic_factors table needs 'SNP New' enrollment_status rows populated with SNPNE coefficients from the CMS rate announcement. SNPNE remains excluded from disease factors (demographic-only model). Closes #1237
1 parent dd62801 commit a0fabc5

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

models/cms_hcc/intermediate/cms_hcc__int_members.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ with stg_eligibility as (
2626
, elig.dual_status_code
2727
, elig.medicare_status_code
2828
, elig.enrollment_status
29+
, elig.institutional_snp_flag
2930
, dates.collection_year
3031
, dates.payment_year
3132
, dates.collection_start_date
@@ -141,6 +142,7 @@ with stg_eligibility as (
141142
, stg_eligibility.original_reason_entitlement_code
142143
, stg_eligibility.dual_status_code
143144
, stg_eligibility.medicare_status_code
145+
, stg_eligibility.institutional_snp_flag
144146
/* Defaulting to "New" enrollment status when missing */
145147
, case
146148
when stg_eligibility.enrollment_status is not null then stg_eligibility.enrollment_status
@@ -185,6 +187,7 @@ with stg_eligibility as (
185187
, dual_status_code
186188
, medicare_status_code
187189
, enrollment_status
190+
, institutional_snp_flag
188191
, enrollment_status_default
189192
, case
190193
when enrollment_status = 'New' and payment_year_age between 0 and 34 then '0-34'
@@ -231,6 +234,7 @@ with stg_eligibility as (
231234
, collection_start_date
232235
, collection_end_date
233236
, enrollment_status
237+
, institutional_snp_flag
234238
, case
235239
when gender = 'female' then 'Female'
236240
when gender = 'male' then 'Male'
@@ -323,6 +327,7 @@ with stg_eligibility as (
323327
, cast(orec as {{ dbt.type_string() }}) as orec
324328
, cast(institutional_status as {{ dbt.type_string() }}) as institutional_status
325329
, cast(originally_disabled_flag as {{ dbt.type_string() }}) as originally_disabled_flag
330+
, cast(institutional_snp_flag as {{ dbt.type_int() }}) as institutional_snp_flag
326331
{% if target.type == 'fabric' %}
327332
, cast(enrollment_status_default as bit) as enrollment_status_default
328333
, cast(medicaid_dual_status_default as bit) as medicaid_dual_status_default
@@ -352,6 +357,7 @@ select
352357
, orec
353358
, institutional_status
354359
, originally_disabled_flag
360+
, institutional_snp_flag
355361
, enrollment_status_default
356362
, medicaid_dual_status_default
357363
, orec_default

models/cms_hcc/intermediate/factors/cms_hcc__int_demographic_factors.sql

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ with members as (
1616
, orec
1717
, originally_disabled_flag
1818
, institutional_status
19+
, institutional_snp_flag
1920
, enrollment_status_default
2021
, medicaid_dual_status_default
2122
, orec_default
@@ -42,6 +43,8 @@ with members as (
4243
, case
4344
-- ESRD
4445
when enrollment_status = 'ESRD' then 'ESRD'
46+
-- SNP New Enrollee
47+
when enrollment_status = 'SNP New' then 'SNPNE'
4548
-- New Enrollee
4649
when enrollment_status = 'New' then 'E'
4750
-- Long Term Institutional (INS)
@@ -103,6 +106,49 @@ with members as (
103106
else 'Aged'
104107
end = seed_demographic_factors.orec
105108
where members.enrollment_status = 'New'
109+
and coalesce(members.institutional_snp_flag, 0) != 1
110+
)
111+
112+
/*
113+
SNP New Enrollees use SNPNE-specific coefficients from the seed
114+
(enrollment_status = 'SNP New'). Same join structure as regular NE
115+
but for members enrolled in a Special Needs Plan.
116+
*/
117+
, snpne_enrollees as (
118+
select
119+
members.person_id
120+
, members.payer
121+
, members.enrollment_status
122+
, members.gender
123+
, members.age_group
124+
, members.medicaid_status
125+
, members.dual_status
126+
, members.orec
127+
, members.originally_disabled_flag
128+
, members.institutional_status
129+
, members.enrollment_status_default
130+
, members.medicaid_dual_status_default
131+
, members.orec_default
132+
, members.institutional_status_default
133+
, members.payment_year
134+
, members.collection_start_date
135+
, members.collection_end_date
136+
, seed_demographic_factors.model_version
137+
, seed_demographic_factors.factor_type
138+
, seed_demographic_factors.coefficient
139+
, seed_demographic_factors.risk_model_code
140+
from members
141+
inner join seed_demographic_factors
142+
on seed_demographic_factors.enrollment_status = 'SNP New'
143+
and members.gender = seed_demographic_factors.gender
144+
and members.age_group = seed_demographic_factors.age_group
145+
and members.medicaid_status = seed_demographic_factors.medicaid_status
146+
and case
147+
when members.originally_disabled_flag = 'Yes' then 'Disabled'
148+
else 'Aged'
149+
end = seed_demographic_factors.orec
150+
where members.enrollment_status = 'New'
151+
and members.institutional_snp_flag = 1
106152
)
107153

108154
, continuing_enrollees as (
@@ -175,6 +221,8 @@ with members as (
175221
, unioned as (
176222
select * from new_enrollees
177223
union all
224+
select * from snpne_enrollees
225+
union all
178226
select * from continuing_enrollees
179227
union all
180228
select * from institutional_enrollees

models/cms_hcc/staging/cms_hcc__stg_core__eligibility.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ select distinct
1212
, dual_status_code
1313
, medicare_status_code
1414
, enrollment_status
15+
, institutional_snp_flag
1516
, data_source
1617
, cast('{{ var('tuva_last_run') }}' as {{ dbt.type_timestamp() }}) as tuva_last_run
1718
from {{ ref('core__eligibility') }}

0 commit comments

Comments
 (0)