Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DQ Changes for Streamlit #642

Merged
merged 2 commits into from
Nov 1, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ with unioned_data as (

select
data_quality_check
, result_count
, coalesce(result_count,0) as result_count
, coalesce(normally_zero ,1) as normally_zero
, '{{ var('tuva_last_run')}}' as tuva_last_run
from unioned_data
14 changes: 7 additions & 7 deletions models/data_quality/final/data_quality__claim_date_trends.sql
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ with date_stage as(

select
cast(all_date.year_month as {{ dbt.type_int() }} ) as year_month
, claim_start.result_count as claim_start_date
, claim_end.result_count as claim_end_date
, admission_date.result_count as admission_date
, discharge_date.result_count as discharge_date
, med_paid_date.result_count as medical_paid_date
, dispensing_date.result_count as dispensing_date
, pharm_paid_date.result_count as pharmacy_paid_date
, coalesce(claim_start.result_count,0) as claim_start_date
, coalesce(claim_end.result_count,0) as claim_end_date
, coalesce(admission_date.result_count,0) as admission_date
, coalesce(discharge_date.result_count,0) as discharge_date
, coalesce(med_paid_date.result_count,0) as medical_paid_date
, coalesce(dispensing_date.result_count,0) as dispensing_date
, coalesce(pharm_paid_date.result_count,0) as pharmacy_paid_date
, '{{ var('tuva_last_run')}}' as tuva_last_run
from all_date_range all_date
left join date_stage claim_start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ cross join total_patients
select
ref_data.analytics_concept
, coalesce(results.condition, ref_data.analytics_measure) as analytics_measure
, results.patients
, results.condition_rank as value_rank
, results.percent_of_total as data_source_value
, coalesce(results.patients,0) as patients
, coalesce(results.percent_of_total,0) as data_source_value
, ref_data.analytics_value
, coalesce(results.condition_rank,0) as value_rank
, ref_data.value_rank as medicare_lds_condition_rank
, '{{ var('tuva_last_run') }}' as tuva_last_run
from {{ ref('data_quality__reference_mart_analytics') }} ref_data
Expand Down
12 changes: 6 additions & 6 deletions models/data_quality/intermediate/data_quality__dx_and_px.sql
Original file line number Diff line number Diff line change
Expand Up @@ -407,37 +407,37 @@ with unpivot_diagnosis as(

, final as (
select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check
,result_count
, cast( result_count as {{ dbt.type_int() }}) as result_count
from missing_primary_dx

union all

select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check
,result_count
, cast( result_count as {{ dbt.type_int() }}) as result_count
from invalid_primary_dx

union all

select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check
,result_count
, cast( result_count as {{ dbt.type_int() }}) as result_count
from multiple_primary_dx

union all

select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check
,result_count
, cast( result_count as {{ dbt.type_int() }}) as result_count
from invalid_secondary_dx

union all

select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check
,result_count
, cast( result_count as {{ dbt.type_int() }}) as result_count
from claims_with_secondary_dx

union all

select cast(data_quality_check as {{ dbt.type_string() }} ) as data_quality_check
,result_count
, cast( result_count as {{ dbt.type_int() }}) as result_count
from invalid_procedure
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ with expected_groups as (
)

select
e.encounter_group as missing_encounter_group
a.encounter_group
, case
when a.encounter_group is null then 'missing'
else 'populated'
end as missing_encounter_group
, '{{ var('tuva_last_run') }}' as tuva_last_run
from expected_groups e
left join actual_groups a
on e.encounter_group = a.encounter_group
where a.encounter_group is null
left join actual_groups a
on e.encounter_group = a.encounter_group
Loading