Skip to content

Commit 4166e8c

Browse files
authored
Fix/extension columns claims-only guard & core model enabled config (tuva-health#1213)
* fix: add payer column to condition model * feat: add synthetic extension columns to various models for passthrough testing * fix: add payer column to core clinical condition model * fix: update config to enable claims and clinical checks for extension columns * fix: add claims_enabled guard to 32 semantic layer models Semantic layer models that ref() claims-only upstream marts (cms_hcc, financial_pmpm, readmissions, ed_classification, etc.) crashed at compile time when claims_enabled was false. Added claims_enabled to their enabled config so they silently disable when claims data is unavailable. 10 models that only depend on clinical-compatible upstream are left unguarded.
1 parent 46c5b24 commit 4166e8c

53 files changed

Lines changed: 147 additions & 77 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

integration_tests/models/appointment.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252

5353
{% if var('use_synthetic_data') == true -%}
5454

55-
select * from {{ ref('appointment_seed') }}
55+
select
56+
{{ tuva_columns }}
57+
{{ tuva_extensions }}
58+
{{ tuva_metadata }}
59+
from {{ ref('appointment_seed') }}
5660

5761
{%- else -%}
5862

integration_tests/models/condition.sql

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
{%- set tuva_columns -%}
88
condition_id
9+
, payer
910
, person_id
1011
, patient_id
1112
, encounter_id
@@ -40,10 +41,19 @@
4041
, ingest_datetime
4142
{%- endset -%}
4243

44+
{# Uncomment the synthetic extension columns below to test extension columns passthrough feature #}
45+
{%- set tuva_synthetic_extensions -%}
46+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_status #}
47+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_condition_type #}
48+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_source_code #}
49+
{# , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as zzz_temp_recorded_date #}
50+
{%- endset -%}
51+
4352
{% if var('use_synthetic_data') == true -%}
4453

4554
select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
4655
cast(null as {{ dbt.type_string() }}) as condition_id
56+
, cast(null as {{ dbt.type_string() }}) as payer
4757
, cast(null as {{ dbt.type_string() }}) as person_id
4858
, cast(null as {{ dbt.type_string() }}) as patient_id
4959
, cast(null as {{ dbt.type_string() }}) as encounter_id
@@ -62,10 +72,7 @@ select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
6272
, cast(null as {{ dbt.type_int() }}) as condition_rank
6373
, cast(null as {{ dbt.type_string() }}) as present_on_admit_code
6474
, cast(null as {{ dbt.type_string() }}) as present_on_admit_description
65-
, cast(null as {{ dbt.type_string() }}) as x_temp_status
66-
, cast(null as {{ dbt.type_string() }}) as x_temp_condition_type
67-
, cast(null as {{ dbt.type_string() }}) as x_temp_source_code
68-
, {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as zzz_temp_recorded_date
75+
{{ tuva_synthetic_extensions }}
6976
, cast(null as {{ dbt.type_string() }}) as data_source
7077
, cast(null as {{ dbt.type_string() }}) as file_name
7178
, cast(null as {{ dbt.type_timestamp() }}) as ingest_datetime

integration_tests/models/eligibility.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@
5858

5959
{% if var('use_synthetic_data') == true -%}
6060

61-
select * from {{ ref('eligibility_seed') }}
61+
select
62+
{{ tuva_columns }}
63+
{{ tuva_extensions }}
64+
{{ tuva_metadata }}
65+
from {{ ref('eligibility_seed') }}
6266

6367
{%- else -%}
6468

integration_tests/models/encounter.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@
4646
, ingest_datetime
4747
{%- endset -%}
4848

49+
{# Uncomment the synthetic extension columns below to test extension columns passthrough feature #}
50+
{%- set tuva_synthetic_extensions -%}
51+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_encounter_type #}
52+
{# , {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as x_temp_encounter_start_date #}
53+
{# , cast(null as {{ dbt.type_string() }}) as zzz_temp_facility_name #}
54+
{%- endset -%}
55+
4956
{% if var('use_synthetic_data') == true -%}
5057

5158
select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
@@ -75,9 +82,7 @@ select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
7582
, cast(null as {{ dbt.type_float() }}) as paid_amount
7683
, cast(null as {{ dbt.type_float() }}) as allowed_amount
7784
, cast(null as {{ dbt.type_float() }}) as charge_amount
78-
, cast(null as {{ dbt.type_string() }}) as x_temp_encounter_type
79-
, {{ try_to_cast_date('null', 'YYYY-MM-DD') }} as x_temp_encounter_start_date
80-
, cast(null as {{ dbt.type_string() }}) as zzz_temp_facility_name
85+
{{ tuva_synthetic_extensions }}
8186
, cast(null as {{ dbt.type_string() }}) as data_source
8287
, cast(null as {{ dbt.type_string() }}) as file_name
8388
, cast(null as {{ dbt.type_timestamp() }}) as ingest_datetime

integration_tests/models/immunization.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@
4242

4343
{% if var('use_synthetic_data') == true -%}
4444

45-
select * from {{ ref('immunization_seed') }}
45+
select
46+
{{ tuva_columns }}
47+
{{ tuva_extensions }}
48+
{{ tuva_metadata }}
49+
from {{ ref('immunization_seed') }}
4650

4751
{%- else -%}
4852

integration_tests/models/lab_result.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454

5555
{% if var('use_synthetic_data') == true -%}
5656

57-
select * from {{ ref('lab_result_seed') }}
57+
select
58+
{{ tuva_columns }}
59+
{{ tuva_extensions }}
60+
{{ tuva_metadata }}
61+
from {{ ref('lab_result_seed') }}
5862

5963
{%- else -%}
6064

integration_tests/models/location.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
, ingest_datetime
3232
{%- endset -%}
3333

34+
{# Uncomment the synthetic extension columns below to test extension columns passthrough feature #}
35+
{%- set tuva_synthetic_extensions -%}
36+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_state #}
37+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_parent_organization #}
38+
{# , cast(null as {{ dbt.type_string() }}) as zzz_temp_facility_type #}
39+
{%- endset -%}
40+
3441
{% if var('use_synthetic_data') == true -%}
3542

3643
select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
@@ -45,9 +52,7 @@ select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
4552
, cast(null as {{ dbt.type_string() }}) as zip_code
4653
, cast(null as {{ dbt.type_float() }}) as latitude
4754
, cast(null as {{ dbt.type_float() }}) as longitude
48-
, cast(null as {{ dbt.type_string() }}) as x_temp_state
49-
, cast(null as {{ dbt.type_string() }}) as x_temp_parent_organization
50-
, cast(null as {{ dbt.type_string() }}) as zzz_temp_facility_type
55+
{{ tuva_synthetic_extensions }}
5156
, cast(null as {{ dbt.type_string() }}) as data_source
5257
, cast(null as {{ dbt.type_string() }}) as file_name
5358
, cast(null as {{ dbt.type_timestamp() }}) as ingest_datetime

integration_tests/models/medical_claim.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@
168168

169169
{% if var('use_synthetic_data') == true -%}
170170

171-
select * from {{ ref('medical_claim_seed') }}
171+
select
172+
{{ tuva_columns }}
173+
{{ tuva_extensions }}
174+
{{ tuva_metadata }}
175+
from {{ ref('medical_claim_seed') }}
172176

173177
{%- else -%}
174178

integration_tests/models/medication.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141
, ingest_datetime
4242
{%- endset -%}
4343

44+
{# Uncomment the synthetic extension columns below to test extension columns passthrough feature #}
45+
{%- set tuva_synthetic_extensions -%}
46+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_rxnorm_code #}
47+
{# , cast(null as {{ dbt.type_string() }}) as x_temp_source_code_type #}
48+
{# , cast(null as {{ dbt.type_string() }}) as zzz_temp_source_code #}
49+
{%- endset -%}
50+
4451
{% if var('use_synthetic_data') == true -%}
4552

4653
select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
@@ -65,9 +72,7 @@ select {% if target.type == 'fabric' %} top 0 {% else %}{% endif %}
6572
, cast(null as {{ dbt.type_string() }}) as quantity_unit
6673
, cast(null as {{ dbt.type_int() }}) as days_supply
6774
, cast(null as {{ dbt.type_string() }}) as practitioner_id
68-
, cast(null as {{ dbt.type_string() }}) as x_temp_rxnorm_code
69-
, cast(null as {{ dbt.type_string() }}) as x_temp_source_code_type
70-
, cast(null as {{ dbt.type_string() }}) as zzz_temp_source_code
75+
{{ tuva_synthetic_extensions }}
7176
, cast(null as {{ dbt.type_string() }}) as data_source
7277
, cast(null as {{ dbt.type_string() }}) as file_name
7378
, cast(null as {{ dbt.type_timestamp() }}) as ingest_datetime

integration_tests/models/observation.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@
4141

4242
{% if var('use_synthetic_data') == true -%}
4343

44-
select * from {{ ref('observation_seed') }}
44+
select
45+
{{ tuva_columns }}
46+
{{ tuva_extensions }}
47+
{{ tuva_metadata }}
48+
from {{ ref('observation_seed') }}
4549

4650
{%- else -%}
4751

0 commit comments

Comments
 (0)