-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add comorbidity suspecting logic for HCC 37 - Diabetes with Chronic C…
…omplications (#426) * Add new value sets seed * Add new comorbidity model * Add list rollup model * Update seed name * Rename column * Fix hcc * Update dbt docs * Add function to cast string to resolve redshift error * Bump package version * Refactor comorbidity table * update dbt docs
- Loading branch information
1 parent
ec0c800
commit 85a5b71
Showing
10 changed files
with
1,047 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: 'the_tuva_project' | ||
version: '0.7.12' | ||
version: '0.7.13' | ||
config-version: 2 | ||
require-dbt-version: ">=1.3.0" | ||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
models/hcc_suspecting/final/hcc_suspecting__list_rollup.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{ config( | ||
enabled = var('hcc_suspecting_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False)))) | as_bool | ||
) | ||
}} | ||
|
||
with list as ( | ||
|
||
select | ||
patient_id | ||
, data_source | ||
, hcc_code | ||
, hcc_description | ||
, reason | ||
, contributing_factor | ||
, condition_date | ||
, row_number() over ( | ||
partition by | ||
patient_id | ||
, hcc_code | ||
order by condition_date desc | ||
) as row_num | ||
from {{ ref('hcc_suspecting__list') }} | ||
|
||
) | ||
|
||
, list_dedupe as ( | ||
|
||
select | ||
patient_id | ||
, hcc_code | ||
, hcc_description | ||
, reason | ||
, contributing_factor | ||
, condition_date as latest_condition_date | ||
from list | ||
where row_num = 1 | ||
|
||
) | ||
|
||
, add_data_types as ( | ||
|
||
select | ||
cast(patient_id as {{ dbt.type_string() }}) as patient_id | ||
, cast(hcc_code as {{ dbt.type_string() }}) as hcc_code | ||
, cast(hcc_description as {{ dbt.type_string() }}) as hcc_description | ||
, cast(reason as {{ dbt.type_string() }}) as reason | ||
, cast(contributing_factor as {{ dbt.type_string() }}) as contributing_factor | ||
, cast(latest_condition_date as date) as latest_condition_date | ||
from list_dedupe | ||
|
||
) | ||
|
||
select | ||
patient_id | ||
, hcc_code | ||
, hcc_description | ||
, reason | ||
, contributing_factor | ||
, latest_condition_date | ||
, '{{ var('tuva_last_run')}}' as tuva_last_run | ||
from add_data_types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.