Skip to content

Commit

Permalink
NQF0053 Osteoporosis Management in women who had a fracture (#436)
Browse files Browse the repository at this point in the history
* feat: changed exclusions

* feat: shared exclusions for hospice and snp

* feat: shared exclusions for frailty

* feat: added common exclusion models and materialized as tables

* docs: updated schema names

* feat: updated the project version

* refactor: changed the schema names and removed older excluion logic

* docs: updated the tuva version

* feat: updated the seed files

* feat: deno models

* feat: created denominator model and updated perf period

* feat: updated both deno conditions

* docs: updated the docs and specified the schema

* osteo_numerator_procedure_only

* schema definition for nqf0053 numerator in yml

* changed codes from fracture diagnoses to procedures

* pharmacy_claims-numerator initial

* fix: refactored the source tables and updated the lookback period logic

* feat: numerator from procedure and pharmacy_claims

* minor: aesthetic changes

* Add observation suspecting logic for HCC 48 - Morbid Obesity (#429)

* add new clinical concepts

* add new observation models

* add new observation models

* add observation model to final list

* update models yml

* increment package version and update dbt docs

* remove diabetes in pregnancy codes

* fix observation staging and casting issues

* minor: denominator encounter filters

* feat: updated encounter type

* feat: numerator untested

* feat: numerator with recorded date from deno

* feat: updated emergency encounter type

* feat: created custom exclusions for NQF0053

* docs: updated the docs and specified the schema

* revert: reverted ED in encounter type

* feat: numerator and denominator

* feat: added lookback period for december

* docs: 0053 numerator column description added in yml

* minor: lookback fieldname change

* feat: 0053 long model and docs

* docs: staging medication table column update yml

* refactor: combined two same ctes into one

* minor: numerator

* feat: created exclusion model

* feat: updated long table

* feat: exclusions_utsav

* docs: exclusion yaml

* feat: exclusion with shared exclusion name updated

* feat: added final exclusion table

* feat: added nqf0053 in summary tables

* docs: removed unused columns

* fix: removed unused columns in NQf0059 diabetes

* docs: updated the tuva project version to 0.7.17

* minor: #15 pull request aesthetic changes

* docs: updated seed with rx code ndc

* feat: nqf0053 PR changes

* feat: denominator PR changes

Co-authored-by: Sarah Morgan <sarah@tuvahealth.com>

* docs: tuva version update

* feat: exclusion PR changes

---------

Co-authored-by: Deepson Shrestha <shresthadeepson317@gmail.com>
Co-authored-by: Deepson Shrestha <53638102+deepsonshrestha@users.noreply.github.com>
Co-authored-by: Sarah Morgan <sarah@tuvahealth.com>
  • Loading branch information
4 people authored and tuvaforrest committed May 7, 2024
1 parent 94aa48d commit bf090b1
Show file tree
Hide file tree
Showing 15 changed files with 6,000 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'the_tuva_project'
version: '0.7.17'
version: '0.7.18'
config-version: 2
require-dbt-version: ">=1.3.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ with measures_unioned as (
union all
select * from {{ ref('quality_measures__int_nqf0059_long') }}
union all
select * from {{ ref('quality_measures__int_cqm236_long')}}
select * from {{ ref('quality_measures__int_cqm236_long') }}
union all
select * from {{ ref('quality_measures__int_nqf0053_long') }}

)

Expand Down
15 changes: 15 additions & 0 deletions models/quality_measures/final/quality_measures__summary_wide.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ with measures_long as (

)

,nqf_0053 as (

select
patient_id
, performance_flag
from measures_long
where measure_id = 'NQF0053'

)

, joined as (

select
Expand All @@ -67,6 +77,7 @@ with measures_long as (
, nqf_0034.performance_flag as nqf_0034
, nqf_0059.performance_flag as nqf_0059
, cqm_236.performance_flag as cqm_236
, nqf_0053.performance_flag as nqf_0053
from measures_long
left join nqf_2372
on measures_long.patient_id = nqf_2372.patient_id
Expand All @@ -76,6 +87,8 @@ with measures_long as (
on measures_long.patient_id = nqf_0059.patient_id
left join cqm_236
on measures_long.patient_id = cqm_236.patient_id
left join nqf_0053
on measures_long.patient_id = nqf_0053.patient_id

)

Expand All @@ -87,6 +100,7 @@ with measures_long as (
, cast(nqf_0034 as integer) as nqf_0034
, cast(nqf_0059 as integer) as nqf_0059
, cast(cqm_236 as integer) as cqm_236
, cast(nqf_0053 as integer) as nqf_0053
from joined

)
Expand All @@ -97,5 +111,6 @@ select
, nqf_0034
, nqf_0059
, cqm_236
, nqf_0053
, '{{ var('tuva_last_run')}}' as tuva_last_run
from add_data_types
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{{ config(
enabled = var('quality_measures_enabled',var('claims_enabled',var('clinical_enabled',var('tuva_marts_enabled',False))))
| as_bool
)
}}

{%- set measure_id -%}
(select id
from {{ ref('quality_measures__measures') }}
where id = 'NQF0053')
{%- endset -%}

{%- set measure_name -%}
(select name
from {{ ref('quality_measures__measures') }}
where id = 'NQF0053')
{%- endset -%}

{%- set measure_version -%}
(select version
from {{ ref('quality_measures__measures') }}
where id = 'NQF0053')
{%- endset -%}

/*
set performance period end to the end of the current calendar year
or use the quality_measures_period_end variable if provided
*/
with period_end as (

select
{% if var('quality_measures_period_end',False) == False -%}
{{ last_day(dbt.current_timestamp(), 'year') }}
{% else -%}
cast('{{ var('quality_measures_period_end') }}' as date)
{%- endif %}
as performance_period_end
)

/*
set performance period begin to a year and a day prior
for a complete calendar year
*/
, period_begin as (

select
performance_period_end
, {{ dbt.dateadd (
datepart = "day"
, interval = +1
, from_date_or_timestamp =
dbt.dateadd (
datepart = "year"
, interval = -1
, from_date_or_timestamp = "performance_period_end"
)
) }} as performance_period_begin
from period_end

)

-- lookback_period for last june 30 and december 31
, lookback_period as (

select
*
, case
when performance_period_end >= cast(extract(year from performance_period_end) || '-06-30' as date)
then extract(year from performance_period_end) || '-06-30'
else extract(year from performance_period_begin) || '-06-30'
end as lookback_period_june
, case
when performance_period_end >= cast(extract(year from performance_period_end) || '-12-31' as date)
then extract(year from performance_period_end) || '-12-31'
else extract(year from performance_period_begin) || '-12-31'
end as lookback_period_december
from period_begin

)

select
cast({{ measure_id }} as {{ dbt.type_string() }}) as measure_id
, cast({{ measure_name }} as {{ dbt.type_string() }}) as measure_name
, cast({{ measure_version }} as {{ dbt.type_string() }}) as measure_version
, cast(performance_period_begin as date) as performance_period_begin
, cast(performance_period_end as date) as performance_period_end
, cast(lookback_period_june as date) as lookback_period_june
, cast(lookback_period_december as date) as lookback_period_december
from lookback_period
Loading

0 comments on commit bf090b1

Please sign in to comment.